EXIficient

com.siemens.ct.exi.io
Class BitInputStream

java.lang.Object
  extended by com.siemens.ct.exi.io.BitInputStream

public final class BitInputStream
extends java.lang.Object

Read bits and bytes from an underlying input stream.

Version:
0.3.20081014
Author:
Daniel.Peintner.EXT@siemens.com, Joerg.Heuer@siemens.com

Field Summary
static int BUFFER_CAPACITY
           
 
Constructor Summary
BitInputStream(java.io.InputStream istream)
          Construct an instance of this class from an input stream.
 
Method Summary
 void align()
          Discard any bits currently in the buffer to byte-align stream
 int readBit()
          Return next bit from underlying stream.
 int readBits(int n)
          Read the next n bits and return the result as an integer.
 int readDirectByte()
          Read and return the next byte without discarding current buffer.
 void setInputStream(java.io.InputStream istream)
          Resets this instance and sets a new underlying input stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_CAPACITY

public static final int BUFFER_CAPACITY
See Also:
Constant Field Values
Constructor Detail

BitInputStream

public BitInputStream(java.io.InputStream istream)
Construct an instance of this class from an input stream.

Method Detail

setInputStream

public void setInputStream(java.io.InputStream istream)
Resets this instance and sets a new underlying input stream. This method allows instances of this class to be re-used. The resulting state after calling this method is identical to that of a newly created instance.


align

public void align()
           throws java.io.IOException
Discard any bits currently in the buffer to byte-align stream

Throws:
java.io.IOException

readBit

public int readBit()
            throws java.io.IOException
Return next bit from underlying stream.

Throws:
java.io.IOException

readBits

public int readBits(int n)
             throws java.io.IOException
Read the next n bits and return the result as an integer.

Parameters:
n - The number of bits in the range [1,32].
Throws:
java.io.IOException

readDirectByte

public int readDirectByte()
                   throws java.io.IOException
Read and return the next byte without discarding current buffer.

Throws:
java.io.IOException

EXIficient