Class BitStreamWriter


  • public class BitStreamWriter
    extends java.lang.Object
    Helper for writing a specific number of bits at a time to a stream.
    • Constructor Summary

      Constructors 
      Constructor Description
      BitStreamWriter​(java.io.OutputStream stream)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void flush()
      Flush the current byte even if there are remaining unused bits left
      void write​(long value, int bits)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BitStreamWriter

        public BitStreamWriter​(java.io.OutputStream stream)
        Parameters:
        stream - The underlying stream
    • Method Detail

      • write

        public void write​(long value,
                          int bits)
                   throws java.io.IOException
        Parameters:
        value - The value to take the bits from (lower order bits first)
        bits - Number of bits to write
        Throws:
        java.io.IOException - On write error
      • flush

        public void flush()
                   throws java.io.IOException
        Flush the current byte even if there are remaining unused bits left
        Throws:
        java.io.IOException - On write error