public class CodeByteStream extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
bitOffset |
protected int |
byteOffset |
protected byte[] |
bytes |
protected int |
markBitOffset |
protected int |
markByteOffset |
Constructor and Description |
---|
CodeByteStream() |
CodeByteStream(byte[] bytes) |
CodeByteStream(int initialByteLength) |
Modifier and Type | Method and Description |
---|---|
int |
byteLength() |
byte[] |
getBytes(int startOffset,
int endOffset) |
protected void |
grow() |
void |
mark() |
int |
readBit()
Reads a single bit (value == 0 or == 1).
|
int |
readBits(int numBits)
Read up to 32 bits from the stream.
|
int |
readByte() |
int |
readGamma()
Reads a value using Gamma coding.
|
int |
readUnary()
Reads a value in unary.
|
char[] |
readUTF() |
void |
reset() |
void |
reset(byte[] bytes) |
void |
reset(byte[] bytes,
int byteOffset) |
boolean |
resetToMark() |
void |
skipBits(int numBits) |
byte[] |
toByteArray() |
void |
writeBit(int value)
Writes a single bit (value == 0 or == 1).
|
void |
writeBits(int value,
int numBits)
Write up to 32 bits to the stream.
|
void |
writeByte(int value) |
void |
writeGamma(int value)
Writes the given value using Gamma coding, in which positive integer x
is represented by coding floor(log2(x) in unary followed by the value
of x - 2**floor(log2(x)) in binary.
|
void |
writeUnary(int value)
Write the given value in unary.
|
void |
writeUTF(char[] str,
int start,
int end) |
protected byte[] bytes
protected int byteOffset
protected int bitOffset
protected int markByteOffset
protected int markBitOffset
public CodeByteStream()
public CodeByteStream(byte[] bytes)
public CodeByteStream(int initialByteLength)
public int byteLength()
public byte[] getBytes(int startOffset, int endOffset)
protected void grow()
public void mark()
public int readBit()
public int readBits(int numBits)
public final int readByte()
public int readGamma()
public char[] readUTF() throws UTFDataFormatException
UTFDataFormatException
public int readUnary()
public void reset()
public void reset(byte[] bytes)
public void reset(byte[] bytes, int byteOffset)
public boolean resetToMark()
public void skipBits(int numBits)
public byte[] toByteArray()
public void writeBit(int value)
public void writeBits(int value, int numBits)
public void writeByte(int value)
public void writeGamma(int value)
public void writeUTF(char[] str, int start, int end)
public void writeUnary(int value)
Copyright © 2019. All rights reserved.