|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectjmp123.decoder.BitStream
public class BitStream
从输入的字节流获得位流。
对于Layer3文件解码, BitStream 仅用于读取帧边信息,要读取Layer3文件的主数据,必须使用BitStreamMainData
。
对于Layer1和Layer2文件解码,用 BitStream 获得的位流,用于解码全部数据。
字段摘要 | |
---|---|
protected int |
bitPos
|
protected byte[] |
bitReservoir
|
protected int |
bytePos
|
构造方法摘要 | |
---|---|
BitStream(int len,
int extra)
创建一个位流BitStream对象,位流的缓冲区大小len指定,位流的缓冲区尾部空出的长度由extra指定。 |
方法摘要 | |
---|---|
int |
append(byte[] b,
int off,
int len)
向缓冲区添加len字节。 |
void |
feed(byte[] b,
int off)
将缓冲指定为b,缓冲区初始偏移量由off指定。 |
int |
get1Bit()
从缓冲区读取一位。 |
int |
getBits17(int n)
从缓冲区读取n位。 |
int |
getBits9(int n)
从缓冲区读取n位。 |
int |
getBytePos()
获取缓冲区字节指针。 |
protected int |
getMark()
|
int |
getSize()
获取缓冲区已经填入的字节数。 |
protected void |
mark()
|
void |
skipBits(int n)
缓冲区丢弃或回退指定比特。 |
void |
skipBytes(int n)
缓冲区丢弃n字节,缓冲区比特指针复位。 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
protected int bitPos
protected int bytePos
protected byte[] bitReservoir
构造方法详细信息 |
---|
public BitStream(int len, int extra)
len
- 缓冲区可访问长度。extra
- 缓冲区尾部空出的字节数,防止哈夫曼解码时位流有错误导致缓冲区溢出,
尾部空出512字节(part2_3_length长度,2^12位)。方法详细信息 |
---|
public int append(byte[] b, int off, int len)
b
- 源数据。off
- 源数据偏移量。len
- 源数据长度。
public void feed(byte[] b, int off)
append(byte[], int, int)
方法的区别是,本方法不会从源数据b复制数据。
b
- 源数据。off
- 源数据偏移量。public int get1Bit()
public int getBits17(int n)
getBits9(int)
方法更高效。
n
- 比特数,n=2..17时调用此方法。
public int getBits9(int n)
n
- 比特数,n=2..9时调用此方法。
public int getBytePos()
public int getSize()
public void skipBytes(int n)
n
- 丢弃的字节数。public void skipBits(int n)
n
- 若n>0丢弃n比特,若n<0则回退-n比特。protected void mark()
protected int getMark()
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |