Package org.teiid.internal.core.index
Class CodeByteStream
- java.lang.Object
-
- org.teiid.internal.core.index.CodeByteStream
-
public class CodeByteStream extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected int
bitOffset
protected int
byteOffset
protected byte[]
bytes
protected int
markBitOffset
protected int
markByteOffset
-
Constructor Summary
Constructors Constructor Description CodeByteStream()
CodeByteStream(byte[] bytes)
CodeByteStream(int initialByteLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Method Detail
-
byteLength
public int byteLength()
-
getBytes
public byte[] getBytes(int startOffset, int endOffset)
-
grow
protected void grow()
-
mark
public void mark()
-
readBit
public int readBit()
Reads a single bit (value == 0 or == 1).
-
readBits
public int readBits(int numBits)
Read up to 32 bits from the stream.
-
readByte
public final int readByte()
-
readGamma
public int readGamma()
Reads a value using Gamma coding.
-
readUTF
public char[] readUTF() throws UTFDataFormatException
- Throws:
UTFDataFormatException
-
readUnary
public int readUnary()
Reads a value in unary.
-
reset
public void reset()
-
reset
public void reset(byte[] bytes)
-
reset
public void reset(byte[] bytes, int byteOffset)
-
resetToMark
public boolean resetToMark()
-
skipBits
public void skipBits(int numBits)
-
toByteArray
public byte[] toByteArray()
-
writeBit
public void writeBit(int value)
Writes a single bit (value == 0 or == 1).
-
writeBits
public void writeBits(int value, int numBits)
Write up to 32 bits to the stream. The least significant numBits bits of value are written.
-
writeByte
public void writeByte(int value)
-
writeGamma
public 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. The value must be >= 1.
-
writeUTF
public void writeUTF(char[] str, int start, int end)
-
writeUnary
public void writeUnary(int value)
Write the given value in unary. The value must be >= 1.
-
-