public WriteVInt ( int i ) : void | ||
i | int | Smaller values take fewer bytes. Negative numbers are /// supported, but should be avoided. |
리턴 | void |
VByte is a variable-length format for positive integers is defined where the high-order bit of each byte indicates whether more bytes remain to be read. The low-order seven bits are appended as increasingly more significant bits in the resulting integer value. Thus values from zero to 127 may be stored in a single byte, values from 128 to 16,383 may be stored in two bytes, and so on.
VByte Encoding Example
Value | Byte 1 | Byte 2 | Byte 3 |
---|---|---|---|
0 | 00000000 | ||
1 | 00000001 | ||
2 | 00000010 | ||
... | |||
127 | 01111111 | ||
128 | 10000000 | 00000001 | |
129 | 10000001 | 00000001 | |
130 | 10000010 | 00000001 | |
... | |||
16,383 | 11111111 | 01111111 | |
16,384 | 10000000 | 10000000 | 00000001 |
16,385 | 10000001 | 10000000 | 00000001 |
... |
this provides compression while still being efficient to decode.
public WriteVInt ( int i ) : void | ||
i | int | Smaller values take fewer bytes. Negative numbers are /// supported, but should be avoided. |
리턴 | void |