public class VIntCoding
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static io.netty.util.concurrent.FastThreadLocal<byte[]> |
encodingBuffer |
static int |
MAX_SIZE |
Constructor and Description |
---|
VIntCoding() |
Modifier and Type | Method and Description |
---|---|
static int |
computeUnsignedVIntSize(java.nio.ByteBuffer input,
int readerIndex)
Computes size of an unsigned vint that starts at readerIndex of the provided ByteBuf.
|
static int |
computeUnsignedVIntSize(java.nio.ByteBuffer input,
int readerIndex,
int readerLimit) |
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 long |
encodeZigZag64(long n)
Encode a ZigZag-encoded 64-bit value.
|
static int |
firstByteValueMask(int extraBytesToRead) |
static long |
getUnsignedVInt(java.nio.ByteBuffer input,
int readerIndex)
Note this method is the same as
readUnsignedVInt(DataInput) ,
except that we do *not* block if there are not enough bytes in the buffer
to reconstruct the value. |
static long |
getUnsignedVInt(java.nio.ByteBuffer input,
int readerIndex,
int readerLimit) |
static int |
numberOfExtraBytesToRead(int firstByte) |
static long |
readUnsignedVInt(java.io.DataInput input) |
static long |
readVInt(java.io.DataInput input) |
static void |
skipUnsignedVInt(DataInputPlus input) |
static void |
writeUnsignedVInt(long value,
java.nio.ByteBuffer output) |
static void |
writeUnsignedVInt(long value,
java.io.DataOutput output) |
static void |
writeVInt(long value,
java.io.DataOutput output) |
public static final int MAX_SIZE
protected static final io.netty.util.concurrent.FastThreadLocal<byte[]> encodingBuffer
public static long readUnsignedVInt(java.io.DataInput input) throws java.io.IOException
java.io.IOException
public static void skipUnsignedVInt(DataInputPlus input) throws java.io.IOException
java.io.IOException
public static long getUnsignedVInt(java.nio.ByteBuffer input, int readerIndex)
readUnsignedVInt(DataInput)
,
except that we do *not* block if there are not enough bytes in the buffer
to reconstruct the value.
WARNING: this method is only safe for vints we know to be representable by a positive long value.public static long getUnsignedVInt(java.nio.ByteBuffer input, int readerIndex, int readerLimit)
public static int computeUnsignedVIntSize(java.nio.ByteBuffer input, int readerIndex)
public static int computeUnsignedVIntSize(java.nio.ByteBuffer input, int readerIndex, int readerLimit)
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)
@Inline public static void writeUnsignedVInt(long value, java.io.DataOutput output) throws java.io.IOException
java.io.IOException
@Inline public static void writeUnsignedVInt(long value, java.nio.ByteBuffer output)
@Inline 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 © 2009-2021 The Apache Software Foundation