public abstract class AbstractVarIntSupport extends Object
| Constructor and Description |
|---|
AbstractVarIntSupport() |
| Modifier and Type | Method and Description |
|---|---|
static int |
computeVarIntSize(int value)
Compute the number of bytes that would be needed to encode a varint.
|
static int |
computeVarLongSize(long value)
Compute the number of bytes that would be needed to encode a varint.
|
static int |
computeVarSignedIntSize(int value)
Compute the number of bytes that would be needed to encode a signed varint.
|
static int |
computeVarSignedLongSize(long value)
Compute the number of bytes that would be needed to encode a signed varint.
|
protected abstract byte |
readByte() |
int |
readVarInt()
Read a raw Varint from the stream.
|
long |
readVarLong()
Read a raw Varint from the stream.
|
int |
readVarSignedInt()
Read an
sint32 field value from the stream. |
long |
readVarSignedLong()
Read an
sint64 field value from the stream. |
protected abstract void |
writeByte(int value) |
void |
writeVarInt(int value)
Encode and write a varint.
|
void |
writeVarLong(long value)
Encode and write a varint.
|
void |
writeVarSignedInt(int value) |
void |
writeVarSignedLong(long value) |
protected abstract byte readByte()
throws IOException
IOExceptionprotected abstract void writeByte(int value)
throws IOException
IOExceptionpublic int readVarInt()
throws IOException
IOExceptionpublic long readVarLong()
throws IOException
IOExceptionpublic int readVarSignedInt()
throws IOException
sint32 field value from the stream.IOExceptionpublic long readVarSignedLong()
throws IOException
sint64 field value from the stream.IOExceptionpublic void writeVarInt(int value)
throws IOException
value is treated as unsigned, so it
won't be sign-extended if negative.IOExceptionpublic void writeVarLong(long value)
throws IOException
IOExceptionpublic void writeVarSignedInt(int value)
throws IOException
IOExceptionpublic void writeVarSignedLong(long value)
throws IOException
IOExceptionpublic static int computeVarIntSize(int value)
value is treated as unsigned, so it won't be sign-extended if
negative.public static int computeVarLongSize(long value)
public static int computeVarSignedIntSize(int value)
public static int computeVarSignedLongSize(long value)
Copyright © 2010–2025 FuseSource, Corp.. All rights reserved.