ccs.utils
Class BitStringWriter

java.lang.Object
  extended by ccs.utils.BitStringWriter

public class BitStringWriter
extends java.lang.Object

A BitStringWriter accepts an arbitrary number of bits, one at a time, which it assembles into a byte string. The treatment is big-endian: the first bit is the high-order bit of the first byte. This is compatible with BitStringReader.


Constructor Summary
BitStringWriter()
           
 
Method Summary
 void add(int bit)
          Add the next bit to the stream.
 byte[] getBytes()
          return the output so far.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitStringWriter

public BitStringWriter()
Method Detail

add

public void add(int bit)
Add the next bit to the stream.


getBytes

public byte[] getBytes()
return the output so far. Only complete bytes will be returned. The writer can still be used after this, but is not reset (so subsequent returns will include the return from this as a prefix).