Class BitReader


  • final class BitReader
    extends java.lang.Object
    Bit reading helpers.
    • Field Detail

      • LOG_BITNESS

        private static final int LOG_BITNESS
      • DEBUG

        private static final int DEBUG
      • BITNESS

        static final int BITNESS
      • BYTENESS

        private static final int BYTENESS
      • HALF_BITNESS

        private static final int HALF_BITNESS
      • HALF_SIZE

        private static final int HALF_SIZE
      • HALVES_CAPACITY

        private static final int HALVES_CAPACITY
      • HALF_BUFFER_SIZE

        private static final int HALF_BUFFER_SIZE
      • HALF_WATERLINE

        private static final int HALF_WATERLINE
      • LOG_HALF_SIZE

        private static final int LOG_HALF_SIZE
    • Constructor Detail

      • BitReader

        BitReader()
    • Method Detail

      • readMoreInput

        static void readMoreInput​(State s)
        Fills up the input buffer.

        No-op if there are at least 36 bytes present after current position.

        After encountering the end of the input stream, 64 additional zero bytes are copied to the buffer.

      • doReadMoreInput

        static void doReadMoreInput​(State s)
      • checkHealth

        static void checkHealth​(State s,
                                int endOfStream)
      • assertAccumulatorHealthy

        static void assertAccumulatorHealthy​(State s)
      • fillBitWindow

        static void fillBitWindow​(State s)
      • doFillBitWindow

        static void doFillBitWindow​(State s)
      • peekBits

        static int peekBits​(State s)
      • readFewBits

        static int readFewBits​(State s,
                               int n)
        Fetches bits from accumulator. WARNING: accumulator MUST contain at least the specified amount of bits, otherwise BitReader will become broken.
      • readBits

        static int readBits​(State s,
                            int n)
      • readManyBits

        private static int readManyBits​(State s,
                                        int n)
      • initBitReader

        static void initBitReader​(State s)
      • prepare

        private static void prepare​(State s)
      • reload

        static void reload​(State s)
      • jumpToByteBoundary

        static void jumpToByteBoundary​(State s)
      • halfAvailable

        static int halfAvailable​(State s)
      • copyRawBytes

        static void copyRawBytes​(State s,
                                 byte[] data,
                                 int offset,
                                 int length)
      • bytesToNibbles

        static void bytesToNibbles​(State s,
                                   int byteLen)
        Translates bytes to halves (int/short).