public class PackedInteger extends Object
PackedInteger is a variable-length integer. The most-significant bit of each byte of a
PackedInteger value indicates whether that byte is the final (lowest-order) byte of the value.
If the bit is 0, then this is the last byte; if the bit is 1, then there is at least one more subsequent
byte pending, and the current value should be shifted to the left by 7 bits to accommodate the next byte's data.
Note: PackedInteger cannot hold signed integer values.| Constructor and Description |
|---|
PackedInteger() |
| Modifier and Type | Method and Description |
|---|---|
static int |
readPackedInteger(DataInput input)
Reads a
PackedInteger value from the passed input and returns the
value of the integer. |
static byte[] |
toPackedInteger(int value) |
static void |
writePackedInteger(DataOutput output,
int value)
|
public static int readPackedInteger(DataInput input) throws IOException
PackedInteger value from the passed input and returns the
value of the integer.input - The DataInput from which the PackedInteger value will be readIOExceptionIllegalArgumentException - If the passed input is nullpublic static void writePackedInteger(DataOutput output, int value) throws IOException
output - The DataOutput to which the PackedInteger is written tovalue - The integer value which will be converted to a PackedIntegerIOExceptionIllegalArgumentException - If the passed value is < 0. PackedInteger doesn't
allow signed integerIllegalArgumentException - If the passed output is nullpublic static byte[] toPackedInteger(int value)
throws IOException
IOExceptionCopyright © 2012 JBoss by Red Hat. All Rights Reserved.