Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.imagero.uio.io
Class BitInputStream  view BitInputStream download BitInputStream.java

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended bycom.imagero.uio.io.BitInputStream
All Implemented Interfaces:
java.io.Closeable

public class BitInputStream
extends java.io.FilterInputStream

adds ability to read streams bitewise and also to read predefined amount of bits every read() call


Field Summary
(package private)  int bitbuf
           
private  int bitsToRead
           
(package private)  int vbits
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
BitInputStream(java.io.InputStream in)
           
 
Method Summary
private  void fillBuffer(int nbits)
           
 int getBitOffset()
           
 int getBitsToRead()
          how much bits is read every read() call (default - 8)
 int read()
          Calls the in.read() method
 int read(byte[] b)
          Calls the read(byte[], int, int) overloaded method.
 int read(byte[] b, int off, int len)
          Reads data from input stream into an byte array.
 int read(int nbits)
           
 void resetBuffer()
          empties bit buffer.
 void setBitsToRead(int bitsToRead)
          set how much bits is read every read() call (max 8)
 long skip(long n)
          Skips some bytes from the input stream.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vbits

int vbits

bitbuf

int bitbuf

bitsToRead

private int bitsToRead
Constructor Detail

BitInputStream

public BitInputStream(java.io.InputStream in)
Method Detail

getBitsToRead

public int getBitsToRead()
how much bits is read every read() call (default - 8)


setBitsToRead

public void setBitsToRead(int bitsToRead)
set how much bits is read every read() call (max 8)


read

public int read()
         throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the in.read() method


read

public int read(int nbits)
         throws java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the read(byte[], int, int) overloaded method. Note that this method does not redirect its call directly to a corresponding method in in. This allows subclasses to override only the three argument version of read.


read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads data from input stream into an byte array.


resetBuffer

public void resetBuffer()
empties bit buffer.


skip

public long skip(long n)
          throws java.io.IOException
Skips some bytes from the input stream. If bit buffer is not empty, n - (vbits + 8) / 8 bytes skipped, then buffer is resetted and filled with same amount of bits as it has before skipping.


fillBuffer

private void fillBuffer(int nbits)
                 throws java.io.IOException

getBitOffset

public int getBitOffset()