Class BitOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public class BitOutputStream
    extends NonBlockingBitOutputStream
    The BitOutputStream allows writing individual bits to a general Java OutputStream. Like the various Stream-classes from Java, the BitOutputStream has to be created based on another OutputStream. This class is able to write a single bit to a stream (even though a byte has to be filled until the data is flushed to the underlying output stream). It is also able to write an integer value to the stream using the specified number of bits.
    For a non-blocking version see NonBlockingBitOutputStream.
    Author:
    Andreas Jakl, Philip Helger
    • Constructor Detail

      • BitOutputStream

        public BitOutputStream​(@Nonnull
                               OutputStream aOS,
                               @Nonnull
                               ByteOrder aByteOrder)
        Create a new bit output stream based on an existing Java OutputStream.
        Parameters:
        aOS - the output stream this class should use. May not be null.
        aByteOrder - The non-null byte order to use.