Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.rgw.io
Class BitOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by ch.rgw.io.BitOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class BitOutputStream
extends java.io.OutputStream

An OutputStream for bitwise writing

Author:
Gerry

Constructor Summary
BitOutputStream(java.io.OutputStream out)
           
 
Method Summary
 void close()
           
 void flush()
          Empty the buffer, flush the remaining bits with zeroes.
 void pushbits(int c, int bitnum)
          Writes up to 32 bit
static java.lang.String Version()
           
 void write(boolean bit)
          write a single bit
 void write(int c)
          writes a byte into the OutputStream, starting at the position of the last written bit (not at a byte boundary)
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitOutputStream

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

Version

public static final java.lang.String Version()

write

public void write(int c)
           throws java.io.IOException
writes a byte into the OutputStream, starting at the position of the last written bit (not at a byte boundary)

Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException
See Also:
OutputStream.write(int)

pushbits

public void pushbits(int c,
                     int bitnum)
              throws java.io.IOException
Writes up to 32 bit

Parameters:
c - an integer containing the bits to be written
bitnum - the number of bits (right aligned inside c) to write.
Throws:
java.io.IOException

write

public void write(boolean bit)
           throws java.io.IOException
write a single bit

Parameters:
bit - true for a 1-Bit, false for a 0-Bit
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Empty the buffer, flush the remaining bits with zeroes.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis