@UnstableApi
public final class VorbisBitArray


Wraps a byte array, providing methods that allow it to be read as a Vorbis bitstream.

See the Vorbis bitpacking specification

Summary

Public constructors

VorbisBitArray(byte[] data)

Creates a new instance that wraps an existing array.

Public methods

int

Returns the number of remaining bits.

int

Returns the reading position in bits.

boolean

Reads a single bit.

int
readBits(int numBits)

Reads up to 32 bits.

void

Resets the reading position to zero.

void
setPosition(int position)

Sets the reading position in bits.

void
skipBits(int numBits)

Skips numberOfBits bits.

Public constructors

VorbisBitArray

public VorbisBitArray(byte[] data)

Creates a new instance that wraps an existing array.

Parameters
byte[] data

the array to wrap.

Public methods

bitsLeft

public int bitsLeft()

Returns the number of remaining bits.

getPosition

public int getPosition()

Returns the reading position in bits.

readBit

public boolean readBit()

Reads a single bit.

Returns
boolean

true if the bit is set, false otherwise.

readBits

public int readBits(int numBits)

Reads up to 32 bits.

Parameters
int numBits

The number of bits to read.

Returns
int

An integer whose bottom numBits bits hold the read data.

reset

public void reset()

Resets the reading position to zero.

setPosition

public void setPosition(int position)

Sets the reading position in bits.

Parameters
int position

The new reading position in bits.

skipBits

public void skipBits(int numBits)

Skips numberOfBits bits.

Parameters
int numBits

The number of bits to skip.