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 intbitOffsetprotected intbyteOffsetprotected byte[]bytesprotected intmarkBitOffsetprotected intmarkByteOffset
-
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 intbyteLength()byte[]getBytes(int startOffset, int endOffset)protected voidgrow()voidmark()intreadBit()Reads a single bit (value == 0 or == 1).intreadBits(int numBits)Read up to 32 bits from the stream.intreadByte()intreadGamma()Reads a value using Gamma coding.intreadUnary()Reads a value in unary.char[]readUTF()voidreset()voidreset(byte[] bytes)voidreset(byte[] bytes, int byteOffset)booleanresetToMark()voidskipBits(int numBits)byte[]toByteArray()voidwriteBit(int value)Writes a single bit (value == 0 or == 1).voidwriteBits(int value, int numBits)Write up to 32 bits to the stream.voidwriteByte(int value)voidwriteGamma(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.voidwriteUnary(int value)Write the given value in unary.voidwriteUTF(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.
-
-