BiSON uses a bit stream in order to achieve maximum possible compression of the different data types, the format is described below.
Each token
is prepended by a 3 bit
field that determines its type
, there are 7
different types:
-
0
: Either aBoolean
ornull
, a2 bit
field with the following values follows:0
=false
1
=true
2
=null
3
is currently unused
-
1
: AInteger
in the range of-
to+
-
2
: A integer. -
3
: AString
-
4
: Start of anArray
, all values until the nexttype = 7
are to be appended to this array. -
5
: Start of anObject
. Pairs ofString
and a value follow, the string is to be used as the key in the object to which the value will be associated with. -
6
: End of the last openedArray
orObject
. -
7
: End of stream. TODO switch withb03