Static methods for reading and writing packed integers.
Note that packed integers are not sorted naturally for a byte-by-byte
comparison because they have a preceding length and are little endian;
therefore, they are typically not used for keys.
Values in the inclusive range [-119,119] are stored in a single byte.
For values outside that range, the first byte stores the sign and the number
of additional bytes. The additional bytes store (abs(value) - 119) as an
unsigned little endian integer.
To read and write packed integer values, call
PackedInteger.readInt and
PackedInteger.writeInt . To get the length of a packed integer without reading it, call
PackedInteger.getReadIntLength . To get the length of an unpacked integer without
writing it, call
PackedInteger.getWriteIntLength .
Note that the packed integer format is designed to accomodate long
integers using up to 9 bytes of storage. Currently only int values are
implemented, but the same format may be used in future for long values.
|