public class SignedLexVarint
extends java.lang.Object
Constructor and Description |
---|
SignedLexVarint() |
Modifier and Type | Method and Description |
---|---|
static int |
encodedLength(int value) |
static int |
encodedLength(long value) |
static int |
readLexVarInt32(java.nio.ByteBuffer buf)
Interprets the next bytes of
buf as a lexicographically comparable signed 32-bit integer. |
static long |
readLexVarInt64(java.nio.ByteBuffer buf)
Interprets the next bytes of
buf as a lexicographically comparable signed 64-bit integer. |
static int |
readReverseLexVarInt32(java.nio.ByteBuffer buf)
Interprets the next bytes of
buf as a lexicographically comparable signed 32-bit integer. |
static long |
readReverseLexVarInt64(java.nio.ByteBuffer buf)
Interprets the next bytes of
buf as a lexicographically comparable signed 64-bit integer. |
static int |
writeLexVarInt32(java.nio.ByteBuffer buf,
int value) |
static int |
writeLexVarInt64(java.nio.ByteBuffer buf,
long value) |
static int |
writeReverseLexVarInt32(java.nio.ByteBuffer buf,
int value) |
static int |
writeReverseLexVarInt64(java.nio.ByteBuffer buf,
long value) |
static byte[] |
writeVarInt32(int value) |
static byte[] |
writeVarInt64(long value) |
public static int encodedLength(int value)
value
- Any integer valuepublic static int encodedLength(long value)
value
- Any long valuepublic static int writeLexVarInt32(java.nio.ByteBuffer buf, int value)
public static int writeReverseLexVarInt32(java.nio.ByteBuffer buf, int value)
public static int writeLexVarInt64(java.nio.ByteBuffer buf, long value)
public static int writeReverseLexVarInt64(java.nio.ByteBuffer buf, long value)
public static int readLexVarInt32(java.nio.ByteBuffer buf) throws AtomLayerException
buf
as a lexicographically comparable signed 32-bit integer. Reads up to 5
bytes from buf
to decode the value.buf
- a bufferAtomLayerException
- if the next bytes are invalid when interpreted as a lexicographically comparable
varintpublic static int readReverseLexVarInt32(java.nio.ByteBuffer buf) throws AtomLayerException
buf
as a lexicographically comparable signed 32-bit integer. Reads up to 5
bytes from buf
to decode the value. Interprets them as a reverse int, eg, s.t. the lexicographical
comparison is reversedbuf
- a bufferAtomLayerException
- if the next bytes are invalid when interpreted as a lexicographically comparable
varintpublic static long readLexVarInt64(java.nio.ByteBuffer buf) throws AtomLayerException
buf
as a lexicographically comparable signed 64-bit integer. Reads up to 9
bytes from buf
to decode the value.buf
- a bufferAtomLayerException
- if the next bytes are invalid when interpreted as a lexicographically comparable
varintpublic static long readReverseLexVarInt64(java.nio.ByteBuffer buf) throws AtomLayerException
buf
as a lexicographically comparable signed 64-bit integer. Reads up to 9
bytes from buf
to decode the value. Interprets them as a reverse int, eg, s.t. the lexicographical
comparison is reversedbuf
- a bufferAtomLayerException
- if the next bytes are invalid when interpreted as a lexicographically comparable
varintpublic static byte[] writeVarInt32(int value)
value
- a 32-bit signed integervalue
encoded as a lexicographically-comparable variable-length integer.public static byte[] writeVarInt64(long value)
value
- a 64-bit signed longvalue
encoded as a lexicographically-comparable variable-length long integer.