private int readCodeBit() throws IOException {
            int b = inputStream.read();
            // Treat end of stream as an infinite number of trailing zeros
            return b != -1 ? b : 0;
        }
Must be called at the end of the stream of input symbols, otherwise the output data
cannot be decoded properly.
indexr-segment/src/main/java/io/indexr/compress/ArthmeticCoder.java