public class VIntCoding
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.ThreadLocal<byte[]> |
encodingBuffer |
Constructor and Description |
---|
VIntCoding() |
Modifier and Type | Method and Description |
---|---|
static int |
computeUnsignedVIntSize(long value)
Compute the number of bytes that would be needed to encode an unsigned varint.
|
static int |
computeVIntSize(long param)
Compute the number of bytes that would be needed to encode a varint.
|
static long |
decodeZigZag64(long n)
Decode a ZigZag-encoded 64-bit value.
|
static int |
encodeExtraBytesToRead(int extraBytesToRead) |
static byte[] |
encodeVInt(long value,
int size) |
static long |
encodeZigZag64(long n)
Encode a ZigZag-encoded 64-bit value.
|
static int |
firstByteValueMask(int extraBytesToRead) |
static int |
numberOfExtraBytesToRead(int firstByte) |
static long |
readUnsignedVInt(java.io.DataInput input) |
static long |
readVInt(java.io.DataInput input) |
static void |
writeUnsignedVInt(long value,
java.io.DataOutput output) |
static void |
writeVInt(long value,
java.io.DataOutput output) |
public static long readUnsignedVInt(java.io.DataInput input) throws java.io.IOException
java.io.IOException
public static long readVInt(java.io.DataInput input) throws java.io.IOException
java.io.IOException
public static int firstByteValueMask(int extraBytesToRead)
public static int encodeExtraBytesToRead(int extraBytesToRead)
public static int numberOfExtraBytesToRead(int firstByte)
public static void writeUnsignedVInt(long value, java.io.DataOutput output) throws java.io.IOException
java.io.IOException
@Inline public static byte[] encodeVInt(long value, int size)
public static void writeVInt(long value, java.io.DataOutput output) throws java.io.IOException
java.io.IOException
public static long decodeZigZag64(long n)
n
- An unsigned 64-bit integer, stored in a signed int because
Java has no explicit unsigned support.public static long encodeZigZag64(long n)
n
- A signed 64-bit integer.public static int computeVIntSize(long param)
public static int computeUnsignedVIntSize(long value)
Copyright © 2017 The Apache Software Foundation