2 ''Binary serialization'' is used in files and network communication.
\r
3 This document gives a specification how Datatypes and Datavalues are written in binary format.
\r
5 All numeric values are in [http://en.wikipedia.org/wiki/Endianness Big Endian] order, aka Network byte order.
\r
8 Boolean is an <code>UINT8</code>, with one of the following values.
\r
10 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
13 |- style="background-color: #f9f9f9;"
\r
19 |- style="background-color: #f9f9f9;"
\r
20 |<code>2..255</code>
\r
25 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
28 |- style="background-color: #f9f9f9;"
\r
34 |- style="background-color: #f9f9f9;"
\r
40 |- style="background-color: #f9f9f9;"
\r
46 There is a Boolean that describes whether there is an actual value.
\r
47 If false no data follows, true the content ensues.
\r
49 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
52 |- style="background-color: #f9f9f9;"
\r
53 |<code>hasValue : Boolean</code>
\r
54 |Tells whether there is a ''value''
\r
57 |The actual value, available only if hasValue == true.
\r
61 String is a series of bytes encoded as [http://download.oracle.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8 Modified-UTF-8].
\r
63 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
66 |- style="background-color: #f9f9f9;"
\r
67 |<code>length : Length</code>
\r
68 |Describes the number of bytes in the string using packed integer encoding (1-5 bytes).
\r
71 |Modified-UTF-8 encoded String.
\r
74 The length is encoded as UInt32 of 1 to 5 bytes.
\r
75 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
78 |- style="background-color: #f9f9f9;"
\r
79 | <code>0x00000000..0x0000007F</code>
\r
80 | ''value'' (1 byte)
\r
82 | <code>0x00000080..0x00003FFF</code>
\r
83 | ''value & 0x3f | 0x80'', ''value>>6 & 0xff'' (2 bytes)
\r
84 |- style="background-color: #f9f9f9;"
\r
85 | <code>0x00004000..0x001FFFFF</code>
\r
86 | ''value & 0x1f | 0xC0'', ''value>>5 & 0xff'', ''value>>13 & 0xff'' (3 bytes)
\r
88 | <code>0x02000000..0x0FFFFFFF</code>
\r
89 | ''value & 0x1f | 0xE0'', ''value>>3 & 0xff'', ''value>>12 & 0xff'', ''value>>20 & 0xff'' (4 bytes)
\r
90 |- style="background-color: #f9f9f9;"
\r
91 | <code>0x10000000..0xFFFFFFFF</code>
\r
92 | ''value & 0x07 | 0xF0'', ''value>>3 & 0xff'', ''value>>11 & 0xff'', ''value>>19 & 0xff'', ''value>>27 & 0xff'' (5 bytes)
\r
98 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
101 |- style="background-color: #f9f9f9;"
\r
102 |<code>length : UInt32</code>
\r
103 |Describes the number of elements as unsigned integer. This field is omited if the range is constant.
\r
105 |''<elements>''
\r
109 ===Generic Record===
\r
110 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
113 |- style="background-color: #f9f9f9;"
\r
114 |''<fields>''
\r
115 |Component fields in the order specified in datatype.
\r
118 ===Referable Record===
\r
119 Referable records are objects that are referenced else where in the datavalue. The way they are serialized is that, when a record is serialized the first time, a 0 is written and then the actual record value. The serializer object gives it a next id number and takes a note of it. Id is not written, it is implicit and only interpretable by reading the stream. When a refereable record the second time, or afterwards, only it's id number is written, not the whole content.
\r
120 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
123 |- style="background-color: #f9f9f9;"
\r
124 |<code>recordId : Integer</code>
\r
125 |Identity that refers in this serialiation to this instance.
\r
127 |''<fields>''
\r
128 |Component fields in the order specified in datatype.
\r
131 ===Generic Union===
\r
132 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
135 |- style="background-color: #f9f9f9;"
\r
136 |<code>tag : Byte, Short or Integer</code>
\r
137 |Number that indicates that type in the UnionType's ''components'' array. Type depends on the number of cases.
\r
140 |The value of the component type.
\r
144 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
147 |- style="background-color: #f9f9f9;"
\r
148 |<code>type : DataType</code>
\r
149 |Describes the datatype of the following value.
\r
152 |The value serialized according to the type
\r
156 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
159 |- style="background-color: #f9f9f9;"
\r
160 |<code>length : UInt32</code>
\r
161 |Describes the number of entries in the map using integer encoding.
\r
163 |''<entries>''
\r
165 |- style="background-color: #f9f9f9;"
\r
166 | <code>key : K</code>
\r
167 |The key serializes according to the Key type
\r
169 | <code>value : V</code>
\r
170 |The value serialized according to the Value type
\r
172 Entries are written in ascending of the key (See [[typesystem.html#Comparison]])
\r
176 {| border="1" cellpadding="3" cellspacing="0" align="center"
\r
180 |<tt>.dbb</tt> ||Databoard Binary File. Concatenation of Datatype + value
\r