Class Vint8

Variable-length encoding of 32-bit integers, into 8-bit bytes. A number is encoded as follows:

If it is less than 127 and non-negative (i.e., if the number uses only 7 bits), it is encoded as
as single byte: 0bbbbbbb.

If its highest nonzero bit is greater than bit 6 (0x40), it is represented as a series of
bytes, each byte's
7 LSB containing bits from the original value, with the MSB set for all but the last
byte. The first encoded byte contains the highest nonzero bits from the
original; the second byte contains the next 7 MSB; and so on, with the last byte
containing the 7 LSB of the original.

Examples:

n = 117 = 1110101: This has fewer than 8 significant bits, and so is encoded as
01110101 = 0x75.

n = 100000 = (binary) 11000011010100000. This has 17 significant bits, and so needs
three Vint8 bytes. Left-zero-pad it to a multiple of 7 bits, then split it into chunks of 7
and add an MSB, 0 for the last byte, 1 for the others: 1|0000110 1|0001101 0|0100000
= 0x86 0x8D 0x20.

This encoder/decoder will correctly handle any 32-bit integer, but for negative numbers,
and positive numbers with more than 28 significant bits, encoding requires 5 bytes; this
is not an efficient encoding scheme for large
positive numbers or any negative number.

Compatibility:
This class has been used in products that have shipped to customers, and is needed to
decode legacy data. Do not modify this class in ways that will break compatibility.

WARNING: This API is experimental and might change in incompatible ways in the next release.

decode

Decodes a 32-bit integer from bytes read from in. Bytes are read,
one at a time, from in, and it is assumed they represent a 32-bit
integer encoded using this class's encoding scheme. The decoded value is
returned.