com.imagero.uio.io
Class BitDataOutputStream

java.lang.Object
  extended bycom.imagero.uio.FilterDataOutput
      extended bycom.imagero.uio.io.BitDataOutputStream
All Implemented Interfaces:
java.io.DataOutput

public class BitDataOutputStream
extends FilterDataOutput

adds ability to write streams bitwise


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 com.imagero.uio.FilterDataOutput
out
 
Constructor Summary
BitDataOutputStream(java.io.DataOutput 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 com.imagero.uio.FilterDataOutput
write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
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

BitDataOutputStream

public BitDataOutputStream(java.io.DataOutput 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.

Specified by:
write in interface java.io.DataOutput
Overrides:
write in class FilterDataOutput
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