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
IOException
protected abstract void writeByte(int value) throws IOException
IOException
public int readVarInt() throws IOException
IOException
public long readVarLong() throws IOException
IOException
public int readVarSignedInt() throws IOException
sint32
field value from the stream.IOException
public long readVarSignedLong() throws IOException
sint64
field value from the stream.IOException
public void writeVarInt(int value) throws IOException
value
is treated as unsigned, so it
won't be sign-extended if negative.IOException
public void writeVarLong(long value) throws IOException
IOException
public void writeVarSignedInt(int value) throws IOException
IOException
public void writeVarSignedLong(long value) throws IOException
IOException
public 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–2021 FuseSource, Corp.. All rights reserved.