Method WriteVInt32
WriteVInt32(Int32)
Writes an
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
ValueByte 1Byte 2Byte 3 | |
---|---|
000000000 | |
100000001 | |
200000010 | |
... | |
12701111111 | |
1281000000000000001 | |
1291000000100000001 | |
1301000001000000001 | |
... | |
16,3831111111101111111 | |
16,384100000001000000000000001 | |
16,385100000011000000000000001 | |
... |
this provides compression while still being efficient to decode.
NOTE: this was writeVInt() in Lucene
Declaration
public void WriteVInt32(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | Smaller values take fewer bytes. Negative numbers are supported, but should be avoided. |