Class BitArrayOutputStream

java.lang.Object
java.io.OutputStream
org.apache.commons.imaging.common.itu_t4.BitArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

class BitArrayOutputStream extends OutputStream
Output stream writing to a byte array, and capable of writing 1 bit at a time, starting from the most significant bit.
  • Field Details

    • buffer

      private byte[] buffer
    • bytesWritten

      private int bytesWritten
    • cache

      private int cache
    • cacheMask

      private int cacheMask
  • Constructor Details

    • BitArrayOutputStream

      BitArrayOutputStream()
    • BitArrayOutputStream

      BitArrayOutputStream(int size)
  • Method Details

    • size

      public int size()
    • toByteArray

      public byte[] toByteArray()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
    • flush

      public void flush()
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
    • write

      public void write(int b)
      Specified by:
      write in class OutputStream
    • writeBit

      public void writeBit(int bit)
    • getBitsAvailableInCurrentByte

      public int getBitsAvailableInCurrentByte()
    • writeByte

      private void writeByte(int b)