IOUtil
Description
Helper class for this namespace.
This class provides some helper methods, dealing with the following:
-
Base-85 coding of binary data, see FromBase85 and ToBase85.
-
Asynchronous flushing, see TaskFlush
-
Read and write 64-bit integer values using minimal byte count (between 1 and 9), see
VarInt*
.
Public / Methods
FromBase85
Decodes binary data from the given base-85 encoded string.
- IOException
-
If data in is malformed.
- See also
VarInt32Length
Returns the number of bytes that are required to encode the given value using variable coding from one to five bytes.
These are the signed number ranges with a specific byte count:
1 byte : [-64 .. 63]
2 bytes : [-8192 .. 8191]
3 bytes : [-1048576 .. 1048575]
4 bytes : [-134217728 .. 134217727]
…
5 bytes
VarInt64Length
Returns the number of bytes that are required to encode the given value using variable coding from one to nine bytes.
These are the number ranges with a specific byte count:
1 byte : [-64 .. 63]
2 bytes : [-8192 .. 8191]
3 bytes : [-1048576 .. 1048575]
4 bytes : [-134217728 .. 134217727]
5 bytes : [-17179869184 .. 17179869183]
6 bytes : [-2199023255552 .. 2199023255551]
7 bytes : [-281474976710656 .. 281474976710655]
8 bytes : [-36028797018963968 .. 36028797018963967]
…
9 bytes (with shortcut opt coding)
…
9 bytes : [-4611686018427387904 .. 4611686018427387903]
10 bytes (without shortcut opt coding)
After emitting 8 bytes with 7 bits of payload each, there are 56 bits in total. With shortcut opt coding, the remaining 8 bits of a 64 bit value are always output without variable coding, as the ninth byte. For values with 56 bits or fewer, shortcut coding has no effect.
VarUInt32Length
Returns the number of bytes that are required to encode the given value using variable coding from one to five bytes.
These are the unsigned number ranges with a specific byte count:
1 byte : [0 .. 127]
2 bytes : [128 .. 16383]
3 bytes : [16384 .. 2097151]
4 bytes : [2097152 .. 268435455]
…
5 bytes
VarUInt64Length
Returns the number of bytes that are required to encode the given value using variable coding from one to nine bytes.
These are the number ranges with a specific byte count:
1 byte : [0 .. 127]
2 bytes : [128 .. 16383]
3 bytes : [16384 .. 2097151]
4 bytes : [2097152 .. 268435455]
5 bytes : [268435456 .. 34359738367]
6 bytes : [34359738368 .. 4398046511103]
7 bytes : [4398046511104 .. 562949953421311]
8 bytes : [562949953421312 .. 72057594037927935]
…
9 bytes (with shortcut opt coding)
…
9 bytes : [72057594037927936 .. 9223372036854775807]
10 bytes (without shortcut opt coding)
After emitting 8 bytes with 7 bits of payload each, there are 56 bits in total. With shortcut opt coding, the remaining 8 bits of a 64 bit value are always output without variable coding, as the ninth byte. For values with 56 bits or fewer, shortcut coding has no effect.