Avro
From Organic Design wiki
Apache Avro is a language neutral, data serialization framework similar that can serialize data into binary very efficiently.
Signed Integer
Avro stores 32 bit integers using ZigZag and variable integer encoding allowing for minimal storage of integers.
Unsigned Integer
Avro does not support unsigned integers by default but they can be implemented as a logical type. To create the unsigned encoding you will need to decode the ZigZag encoding before passing the value:
(num >>> 1) ^ -(num & 1)
Then when retrieving the data encode it with the ZigZag:
(num << 1) ^ (num >> 31)
This allows minimal storage of unsigned integers. This works because you reverse the encoding before Avro encodes it leaving the value unchanged and when reading it you reverse the decoding of the value by encoding it.



