public final class ParsableBitArray extends Object
| Modifier and Type | Field and Description |
|---|---|
byte[] |
data |
| Constructor and Description |
|---|
ParsableBitArray()
Creates a new instance that initially has no backing data.
|
ParsableBitArray(byte[] data)
Creates a new instance that wraps an existing array.
|
ParsableBitArray(byte[] data,
int limit)
Creates a new instance that wraps an existing array.
|
| Modifier and Type | Method and Description |
|---|---|
int |
bitsLeft()
Returns the number of bits yet to be read.
|
boolean |
canReadExpGolombCodedNum()
Returns whether it is possible to read an Exp-Golomb-coded integer starting from the current
offset.
|
int |
getPosition()
Gets the current bit 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)
Updates the instance to wrap
data, and resets the position to zero. |
void |
reset(byte[] data,
int limit)
Updates the instance to wrap
data, and resets the position to zero. |
void |
setPosition(int position)
Sets the current bit offset.
|
void |
skipBits(int n)
Skips bits and moves current reading position forward.
|
public ParsableBitArray()
public ParsableBitArray(byte[] data)
data - The data to wrap.public ParsableBitArray(byte[] data,
int limit)
data - The data to wrap.limit - The limit in bytes.public void reset(byte[] data)
data, and resets the position to zero.data - The array to wrap.public void reset(byte[] data,
int limit)
data, and resets the position to zero.data - The array to wrap.limit - The limit in bytes.public int bitsLeft()
public int getPosition()
public void setPosition(int position)
position - The position to set.public void skipBits(int n)
n - The number of bits to skip.public boolean readBit()
public int readBits(int numBits)
numBits - The number of bits to read.public boolean canReadExpGolombCodedNum()
public int readUnsignedExpGolombCodedInt()
public int readSignedExpGolombCodedInt()