@Override
    public int read() throws IOException {
        if (isEndOfStream)
            return -1;
        if (numBitsRemaining == 0) {
            nextBits = input.read();
            if (nextBits == -1) {
                isEndOfStream = true;
                return -1;
            }
            numBitsRemaining = 8;
        }
        numBitsRemaining--;
        return (nextBits >>> numBitsRemaining) & 1;
    }
A stream of bits that can be read.

<p>Because they come from an underlying byte stream, the total number of bits is always a
multiple of 8. The bits are read in big endian.
indexr-common/src/main/java/io/indexr/io/BitWrappedInputStream.java