Variable Length EncodingΒΆ
The NEO network protocol supports a variable length encoding for space saving. At its basic form byte array data is to be encoded according to the following table
Data length
- nr bytes to encode
length in
Format
< 0xfd
1
uint8 + data
<= 0xffff
3
0xfd + uint16 + data
<= 0xffffffff
5
0xfe + uint32 + data
> 0xffffffff
9
0xff + uint64 + data
The BinaryReader
and BinaryWriter
classes have functions to easily support these. Specifically: