Class BitStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    class BitStream
    extends BitInputStream
    Iterates over the bits of an InputStream. For each byte the bits are read from the right to the left.
    Since:
    1.7
    • Constructor Detail

      • BitStream

        BitStream​(java.io.InputStream in)
    • Method Detail

      • nextBit

        int nextBit()
             throws java.io.IOException
        Returns the next bit.
        Returns:
        The next bit (0 or 1) or -1 if the end of the stream has been reached
        Throws:
        java.io.IOException
      • nextBits

        long nextBits​(int n)
               throws java.io.IOException
        Returns the integer value formed by the n next bits (up to 8 bits).
        Parameters:
        n - the number of bits read (up to 8)
        Returns:
        The value formed by the n bits, or -1 if the end of the stream has been reached
        Throws:
        java.io.IOException
      • nextByte

        int nextByte()
              throws java.io.IOException
        Throws:
        java.io.IOException