public class VarInt extends Object
Constructor and Description |
---|
VarInt() |
Modifier and Type | Method and Description |
---|---|
static long |
decode(byte[] varint)
Decodes a VarInt.
|
static long |
decode(byte[] varint,
int offset)
Decodes a VarInt.
|
static long |
decodeWithKnownSize(byte[] varint,
int offset,
byte extsize)
Decodes a VarInt when the extension size is known.
|
static byte[] |
encode(long val)
Encodes a VarInt.
|
static void |
encode(long val,
byte[] buffer,
int offset,
int size)
Encodes a VarInt and saves it in a buffer at the given offset.
|
static int |
getEncodedSize(long val)
Determines the encoded size of a value.
|
static byte |
getExtensionSize(byte[] varint,
int offset)
Returns the number of bytes used for this number past the first byte.
|
public static final byte getExtensionSize(byte[] varint, int offset)
varint
- Encoded VarInt.offset
- The offset.public static final long decode(byte[] varint)
varint
- The encoded VarInt.public static final long decode(byte[] varint, int offset)
varint
- The encoded VarInt.public static final long decodeWithKnownSize(byte[] varint, int offset, byte extsize)
varint
- The encoded VarInt.offset
- The offset.The
- number of bytes after the first byte.public static final byte[] encode(long val)
val
- The value being encoded.public static final int getEncodedSize(long val)
val
- The value.public static final void encode(long val, byte[] buffer, int offset, int size)
val
- The value being encoded.buffer
- The target buffer.offset
- The buffer offset.size
- Size of the encoded VarInt.Copyright © 2013. All Rights Reserved.