javazoom.jl.decoder

Class Bitstream

public final class Bitstream extends Object implements BitstreamErrors

The Bistream class is responsible for parsing an MPEG audio bitstream. REVIEW: much of the parsing currently occurs in the various decoders. This should be moved into this class and associated inner classes.
Constructor Summary
Bitstream(InputStream in)
Construct a IBitstream that reads data from a given InputStream.
Method Summary
voidclose()
Close the Bitstream.
voidcloseFrame()
Close MP3 frame.
InputStreamgetRawID3v2()
Return raw ID3v2 frames + header.
intget_bits(int number_of_bits)
Read bits from buffer into the lower bits of an unsigned int.
intheader_pos()
Return position of the first audio header.
booleanisSyncCurrentPosition(int syncmode)
Determines if the next 4 bytes of the stream represent a frame header.
booleanisSyncMark(int headerstring, int syncmode, int word)
protected BitstreamExceptionnewBitstreamException(int errorcode)
protected BitstreamExceptionnewBitstreamException(int errorcode, Throwable throwable)
intreadBits(int n)
intreadCheckedBits(int n)
HeaderreadFrame()
Reads and parses the next frame from the input source.
voidunreadFrame()
Unreads the bytes read from the frame.

Constructor Detail

Bitstream

public Bitstream(InputStream in)
Construct a IBitstream that reads data from a given InputStream.

Parameters: in The InputStream to read from.

Method Detail

close

public void close()
Close the Bitstream.

Throws: BitstreamException

closeFrame

public void closeFrame()
Close MP3 frame.

getRawID3v2

public InputStream getRawID3v2()
Return raw ID3v2 frames + header.

Returns: ID3v2 InputStream or null if ID3v2 frames are not available.

get_bits

public int get_bits(int number_of_bits)
Read bits from buffer into the lower bits of an unsigned int. The LSB contains the latest read bit of the stream. (1 <= number_of_bits <= 16)

header_pos

public int header_pos()
Return position of the first audio header.

Returns: size of ID3v2 tag frames.

isSyncCurrentPosition

public boolean isSyncCurrentPosition(int syncmode)
Determines if the next 4 bytes of the stream represent a frame header.

isSyncMark

public boolean isSyncMark(int headerstring, int syncmode, int word)

newBitstreamException

protected BitstreamException newBitstreamException(int errorcode)

newBitstreamException

protected BitstreamException newBitstreamException(int errorcode, Throwable throwable)

readBits

public int readBits(int n)

readCheckedBits

public int readCheckedBits(int n)

readFrame

public Header readFrame()
Reads and parses the next frame from the input source.

Returns: the Header describing details of the frame read, or null if the end of the stream has been reached.

unreadFrame

public void unreadFrame()
Unreads the bytes read from the frame.

Throws: BitstreamException

JavaZOOM 1999-2005