public final class ParsableNalUnitBitArray extends Object
Whenever the byte sequence [0, 0, 3] appears in the wrapped byte array, it is treated as [0, 0] for all reading/skipping operations, which makes the bitstream appear to be unescaped.
Constructor and Description |
---|
ParsableNalUnitBitArray(byte[] data,
int offset,
int limit) |
Modifier and Type | Method and Description |
---|---|
boolean |
canReadBits(int n)
Returns whether it's possible to read
n bits starting from the current offset. |
boolean |
canReadExpGolombCodedNum()
Returns whether it is possible to read an Exp-Golomb-coded integer starting from the current
offset.
|
boolean |
readBit()
Reads a single bit.
|
int |
readBits(int numBits)
Reads up to 32 bits.
|
int |
readSignedExpGolombCodedInt()
Reads an signed Exp-Golomb-coded format integer.
|
int |
readUnsignedExpGolombCodedInt()
Reads an unsigned Exp-Golomb-coded format integer.
|
void |
reset(byte[] data,
int offset,
int limit)
Resets the wrapped data, limit and offset.
|
void |
skipBits(int n)
Skips bits and moves current reading position forward.
|
public ParsableNalUnitBitArray(byte[] data, int offset, int limit)
data
- The data to wrap.offset
- The byte offset in data
to start reading from.limit
- The byte offset of the end of the bitstream in data
.public void reset(byte[] data, int offset, int limit)
data
- The data to wrap.offset
- The byte offset in data
to start reading from.limit
- The byte offset of the end of the bitstream in data
.public void skipBits(int n)
n
- The number of bits to skip.public boolean canReadBits(int n)
n
bits starting from the current offset. The
offset is not modified.n
- The number of bits.n
bits.public boolean readBit()
public int readBits(int numBits)
numBits
- The number of bits to read.public boolean canReadExpGolombCodedNum()
public int readUnsignedExpGolombCodedInt()
public int readSignedExpGolombCodedInt()