com.imagero.uio.io
Class BitOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended bycom.imagero.uio.io.BitOutputStream

public class BitOutputStream
extends java.io.FilterOutputStream

adds ability to write streams bitewise


Field Summary
protected  int bitbuf
           
protected  int fillByte
           
protected  byte[] flipTable
           
protected  boolean invertBitOrder
           
protected static int[] mask
           
protected  int vbits
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
BitOutputStream(java.io.OutputStream out)
           
 
Method Summary
 void flush()
          writes bits from buffer to output stream
 int getBitsToWrite()
           
 int getFillByte()
          get fill byte used to adjust stream to byte boundary.
 boolean isInvertBitOrder()
           
 void setBitsToWrite(int bitsToWrite)
          set how much bits should be written to stream every write() call
 void setFillByte(int fillByte)
          set fill byte used to adjust stream to byte boundary
 void setInvertBitOrder(boolean invertBitOrder)
           
 void write(int b)
          Writes some bits from the specified int to stream.
 void write(int b, int nbits)
          Writes some bits from the specified int to stream.
protected  void write8()
           
 
Methods inherited from class java.io.FilterOutputStream
close, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mask

protected static final int[] mask

bitbuf

protected int bitbuf

vbits

protected int vbits

flipTable

protected byte[] flipTable

invertBitOrder

protected boolean invertBitOrder

fillByte

protected int fillByte
Constructor Detail

BitOutputStream

public BitOutputStream(java.io.OutputStream out)
Method Detail

getBitsToWrite

public int getBitsToWrite()

setBitsToWrite

public void setBitsToWrite(int bitsToWrite)
set how much bits should be written to stream every write() call

Parameters:
bitsToWrite -

isInvertBitOrder

public boolean isInvertBitOrder()

setInvertBitOrder

public void setInvertBitOrder(boolean invertBitOrder)

write

public void write(int b)
           throws java.io.IOException
Writes some bits from the specified int to stream.

Parameters:
b - int which should be written
Throws:
java.io.IOException - if an I/O error occurs
See Also:
setBitsToWrite(int), getBitsToWrite()

write

public void write(int b,
                  int nbits)
           throws java.io.IOException
Writes some bits from the specified int to stream.

Parameters:
b - int which should be written
nbits - bit count to write
Throws:
java.io.IOException - if an I/O error occurs

write8

protected void write8()
               throws java.io.IOException
Throws:
java.io.IOException

getFillByte

public int getFillByte()
get fill byte used to adjust stream to byte boundary.

Returns:
int

setFillByte

public void setFillByte(int fillByte)
set fill byte used to adjust stream to byte boundary

Parameters:
fillByte - int

flush

public void flush()
           throws java.io.IOException
writes bits from buffer to output stream

Throws:
java.io.IOException - if I/O error occurs