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 aBooleanornull, a2 bitfield with the following values follows:0=false1=true2=null3is currently unused
-
1: AIntegerin the range of-to+ -
2: A integer. -
3: AString -
4: Start of anArray, all values until the nexttype = 7are to be appended to this array. -
5: Start of anObject. Pairs ofStringand 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 openedArrayorObject. -
7: End of stream. TODO switch withb03