The interface for both MSB and LSB bit-readers. Provides a bit-level information extraction from densely-packed bitstreams. This interface provides up to a maximum of 32-bit reads at a time, the largest bitwise-safe integer size.

interface BitReader {
    peek32(n: number): number;
    read32(n: number): number;
    skip(n: number): BitReader;
    align(): BitReader;
    isByteAligned(): boolean;
    seek(offset: number): BitReader;
}

Methods

  • Peek at the next n bits in the bitstream. n must be ≤ 32.

    Parameters

    • n: number

    Returns number

    Error if n > 32