org.teiid.internal.core.index
Class CodeByteStream

java.lang.Object
  extended by org.teiid.internal.core.index.CodeByteStream

public class CodeByteStream
extends java.lang.Object


Field Summary
protected  int bitOffset
           
protected  int byteOffset
           
protected  byte[] bytes
           
protected  int markBitOffset
           
protected  int markByteOffset
           
 
Constructor Summary
CodeByteStream()
           
CodeByteStream(byte[] bytes)
           
CodeByteStream(int initialByteLength)
           
 
Method Summary
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytes

protected byte[] bytes

byteOffset

protected int byteOffset

bitOffset

protected int bitOffset

markByteOffset

protected int markByteOffset

markBitOffset

protected int markBitOffset
Constructor Detail

CodeByteStream

public CodeByteStream()

CodeByteStream

public CodeByteStream(byte[] bytes)

CodeByteStream

public CodeByteStream(int initialByteLength)
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 java.io.UTFDataFormatException
Throws:
java.io.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.



Copyright © 2011. All Rights Reserved.