-
Notifications
You must be signed in to change notification settings - Fork 7
Serialized Data
Much of the serialized data (the byte arrays) of various JID actors follows Java conventions--the byte order of a serialized in being a good example. Still it is worth a look at some of the details.
##Jid
The byte array of this actor's serialized data has a size of 0.
##BooleanJid
The byte array of this actor's serialized data has a size of 1, where the value 0 == false and 1 == true.
##IntegerJid
The byte array of this actor's serialized data has a size of 4. Standard Java byte order is used.
##FloatJid
The byte array of this actor's serialized data has a size of 4. Standard Java byte order is used.
##LongJid
The byte array of this actor's serialized data has a size of 8. Standard Java byte order is used.
##DoubleJid
The byte array of this actor's serialized data has a size of 8. Standard Java byte order is used.
##BytesJid
The byte array of this actor's serialized data has a size of 4 + the size of the byte array it contains. The first 4 bytes of the serialized data is a serialized int which holds the size of the contained byte array, while the remainder is the contained byte array.
##StringJid
The serialized data of this actor holds both the length of the string (number of char) as a serialized int, and a char array holding contents of the string. The length of this serialized data is 4 + 2 * (String.length()).
When the contents of StringJid is null, the serialized data is 4 bytes long--a serialized -1.
##ActorJid
The serialized data of this actor holds 3 items:
- A serialized int set to (the total length of the serialized data) -1.
- The actor type of the actor held by the ActorJid, serialized in the same form as a StringJid. And
- The serialized data of the actor held by the ActorJid.
But when the contents of ActorJid is null, the serialized data is only 4 bytes long--a serialized int set to -1.
##RootJid
The serialized data of this actor hold both the actor type of the actor held by the RootJid and the serialized data of the actor held by the RootJid, where the actor type is serialized the same way as a StringJid.
When the contents of RootJid is null, the serialized data is 4 bytes long--a serialized int set to -1.
Note that when a ActorJid and a RootJid have the equivalent contents, the length of the serialized data of the RootJid will be 4 bytes less.
##TupleJid
The serialized data of this actor holds a serialized int set to (the total length of the serialized data) - 4, followed by the serialized data of the various elements held by this actor. So for example, a TupleJid defined as a series of 3 BooleanJid's would have serialized data that is 7 bytes long.
The contents of a TupleJid is never null.
##ListJid
The serialized data of this actor holds two serialized ints followed by the serialized contents of the list. The first int is set to (the total length of the serialized data) - 8, while the second int is set to the number of entries in the list.
The serialized data of an empty list then is 8 bytes long and consists of two serialized ints, both set to 0.
##MapJid
The serialized data of this actor is identical to the serialized data of ListJid, but with the contents being a list of 2-tuples, where the first element of each tuple is a key and the second is a value.