|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.util.VariableByteCoding
This class encodes integer values using variable-byte coding. In variable-byte coding, the value is split into a sequence of 7-bit chunks. Bit 8 is used to indicate if more bytes follow. If bit 8 is 0, all bytes have been read. Variable-byte coding usually achieves good compression ratios for a sequence of random integer values. Compression ratio is bad for very small and very large values.
Constructor Summary | |
VariableByteCoding()
|
Method Summary | |
static void |
copyTo(java.io.InputStream in,
ByteArray out)
|
static void |
copyTo(java.io.InputStream in,
ByteArray out,
int count)
|
static long |
decode(byte[] d,
int offset)
Decode a variable-byte encoded sequence |
static long |
decode(java.io.InputStream is)
Decode a variable-byte encoded sequence |
static long |
decodeFixed(java.io.InputStream is)
|
static void |
encode(ByteArray buf,
long l)
Encode a long integer to a variable-byte encoded sequence of bytes. |
static byte[] |
encode(long l)
Encode a long integer to a variable-byte encoded sequence of bytes. |
static void |
encode(long l,
byte[] data,
int offset)
Encode a long integer to a variable-byte encoded sequence of bytes. |
static void |
encodeFixed(ByteArray buf,
long l)
|
static int |
getSize(long l)
Get the size of the variable-byte encoded sequence for a given long. |
static void |
skipNext(java.io.InputStream is)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public VariableByteCoding()
Method Detail |
public static final long decode(byte[] d, int offset)
d
- the variable-byte encoded sequence of bytesoffset
- the offset at which decoding should start
public static final long decode(java.io.InputStream is) throws java.io.IOException
is
- ByteArrayInputStream to read the variable-byte
encoded data from
java.io.IOException
public static final void skipNext(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static final void copyTo(java.io.InputStream in, ByteArray out) throws java.io.IOException
java.io.IOException
public static final void copyTo(java.io.InputStream in, ByteArray out, int count) throws java.io.IOException
java.io.IOException
public static final byte[] encode(long l)
l
- The long integer value to encode
public static final void encode(long l, byte[] data, int offset)
l
- Description of the Parameterdata
- Description of the Parameteroffset
- Description of the Parameterpublic static final void encode(ByteArray buf, long l)
buf
- Description of the Parameterl
- Description of the Parameterpublic static final void encodeFixed(ByteArray buf, long l)
public static final long decodeFixed(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static final int getSize(long l)
l
- Description of the Parameter
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |