MAM API
(developer's version)

Class BinaryOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by BinaryOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class BinaryOutputStream
extends OutputStream

This output stream provides an eight bit long buffer for writing individual bits.


Field Summary
private  int bCounter
           
private  byte buffer
           
private  OutputStream out
           
 
Constructor Summary
BinaryOutputStream(OutputStream stream)
          Create a binary stream on the top of the given stream.
 
Method Summary
 void flushBitBuffer()
          Flush the bit buffer by padding it with zeros.
 void write(int b)
           
 boolean writeBit(boolean bit)
           
 
Methods inherited from class java.io.OutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

private OutputStream out

buffer

private byte buffer

bCounter

private int bCounter
Constructor Detail

BinaryOutputStream

public BinaryOutputStream(OutputStream stream)
Create a binary stream on the top of the given stream.

Method Detail

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

flushBitBuffer

public void flushBitBuffer()
                    throws IOException
Flush the bit buffer by padding it with zeros.

Throws:
IOException

writeBit

public boolean writeBit(boolean bit)
                 throws IOException
Throws:
IOException

MAM API
(developer's version)

Copyright © 2007 Aija Niissalo, Marko Laakso, Markus Heinonen.