Programming Distributed Systems with YAMI4
1.1 Serialization Format
The parameters object is serialized into a sequence of words according to the following rules:
- the first word contains number of entries - this might be 0, which means that the empty parameters object is serialized to just a single word
Then, for each entry:
- entry name is serialized as its length (word) followed by sequence of characters (possibly padded)
- entry type is serialized as a word (boolean: 1, integer: 2, long: 3, double: 4, string: 5, binary: 6, boolean array: 7, integer array: 8, long array: 9, double array: 10, string array: 11, binary array: 12, nested parameters: 13, nested parameters array: 14)
- entry value, depending on type
The entry value is serialized as follows:
- boolean as a word of value 1 or 0 (for true/false, respectively)
- integer as a word
- long as two words, least significant first
- double as its own bit pattern reinterpreted as long
- string as its length (word) followed by sequence of characters (possibly padded)
- binary as its length (word) followed by sequence of bytes (possibly padded)
- nested parameters: recursively
Arrays are serialized as their length (word) followed by individual elements, according to their type, as described above.