Top Description Fields Constructors Methods
javazoom.jl.decoder

pack-priv final Class BitReserve

extends Object
Class Inheritance

Implementation of Bit Reservoir for Layer III.

The implementation stores single bits as a word in the buffer. If a bit is set, the corresponding word in the buffer will be non-zero. If a bit is clear, the corresponding word is zero. Although this may seem waseful, this can be a factor of two quicker than packing 8 bits to a byte and extracting.

Field Summary

Modifier and TypeField and Description
private final int[]
private int
private static final int
BUFSIZE

Size of the internal buffer to store the reserved bits.

private static final int
BUFSIZE_MASK

Mask that can be used to quickly implement the modulus operation on BUFSIZE.

private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

0 if next bit is reset, or 1 if next bit is set.
hget1bit
()

Returns next bit from reserve.

public int
hgetbits(int
the number of
N
)

Read a number bits from the bit stream.

public void
hputbuf(int val)

Write 8 bits into the bit stream.

public int
hsstell()

Return totbit Field.

public void
rewindNbits(int N)

Rewind N bits in Stream.

public void
rewindNbytes(int N)

Rewind N bytes in Stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private final int[] buf
buf_byte_idxback to summary
private int buf_byte_idx
BUFSIZEback to summary
private static final int BUFSIZE

Size of the internal buffer to store the reserved bits. Must be a power of 2. And x8, as each bit is stored as a single entry.

BUFSIZE_MASKback to summary
private static final int BUFSIZE_MASK

Mask that can be used to quickly implement the modulus operation on BUFSIZE.

offsetback to summary
private int offset
totbitback to summary
private int totbit

Constructor Detail

BitReserveback to summary
pack-priv BitReserve()

Method Detail

hget1bitback to summary
public int hget1bit()

Returns next bit from reserve.

Returns:int

0 if next bit is reset, or 1 if next bit is set.

hgetbitsback to summary
public int hgetbits(int N)

Read a number bits from the bit stream.

Parameters
N:int

the number of

hputbufback to summary
public void hputbuf(int val)

Write 8 bits into the bit stream.

hsstellback to summary
public int hsstell()

Return totbit Field.

rewindNbitsback to summary
public void rewindNbits(int N)

Rewind N bits in Stream.

rewindNbytesback to summary
public void rewindNbytes(int N)

Rewind N bytes in Stream.