docs/doc/reference/com/google/android/exoplayer2/util/ParsableBitArray.html
Package com.google.android.exoplayer2.util
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classParsableBitArrayextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Wraps a byte array, providing methods that allow it to be read as a bitstream.
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| byte[] | data |
Deprecated.
|
Constructors | Constructor | Description |
| --- | --- |
| ParsableBitArray() |
Deprecated.
Creates a new instance that initially has no backing data.
|
| ParsableBitArray(byte[] data) |
Deprecated.
Creates a new instance that wraps an existing array.
|
| ParsableBitArray(byte[] data, int limit) |
Deprecated.
Creates a new instance that wraps an existing array. |
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| int | bitsLeft() |
Deprecated.
Returns the number of bits yet to be read.
|
| void | byteAlign() |
Deprecated.
Aligns the position to the next byte boundary.
|
| int | getBytePosition() |
Deprecated.
Returns the current byte offset.
|
| int | getPosition() |
Deprecated.
Returns the current bit offset.
|
| void | putInt(int value, int numBits) |
Deprecated.
Overwrites numBits from this array using the numBits least significant bits from value.
|
| boolean | readBit() |
Deprecated.
Reads a single bit.
|
| void | readBits(byte[] buffer, int offset, int numBits) |
Deprecated.
Reads numBits bits into buffer.
|
| int | readBits(int numBits) |
Deprecated.
Reads up to 32 bits.
|
| long | readBitsToLong(int numBits) |
Deprecated.
Reads up to 64 bits.
|
| void | readBytes(byte[] buffer, int offset, int length) |
Deprecated.
Reads the next length bytes into buffer.
|
| String | readBytesAsString(int length) |
Deprecated.
Reads the next length bytes as a UTF-8 string.
|
| String | readBytesAsString(int length, Charset charset) |
Deprecated.
Reads the next length bytes as a string encoded in Charset.
|
| void | reset(byte[] data) |
Deprecated.
Updates the instance to wrap data, and resets the position to zero.
|
| void | reset(byte[] data, int limit) |
Deprecated.
Updates the instance to wrap data, and resets the position to zero.
|
| void | reset(ParsableByteArray parsableByteArray) |
Deprecated.
Sets this instance's data, position and limit to match the provided parsableByteArray.
|
| void | setPosition(int position) |
Deprecated.
Sets the current bit offset.
|
| void | skipBit() |
Deprecated.
Skips a single bit.
|
| void | skipBits(int numBits) |
Deprecated.
Skips bits and moves current reading position forward.
|
| void | skipBytes(int length) |
Deprecated.
Skips the next length bytes.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public byte[] data
Deprecated.
-
public ParsableBitArray()
Deprecated.
Creates a new instance that initially has no backing data.
-
public ParsableBitArray(byte[] data)
Deprecated.
Creates a new instance that wraps an existing array.
Parameters:data - The data to wrap.
-
public ParsableBitArray(byte[] data,
int limit)
Deprecated.
Creates a new instance that wraps an existing array.
Parameters:data - The data to wrap.limit - The limit in bytes.
-
public void reset(byte[] data)
Deprecated.
Updates the instance to wrap data, and resets the position to zero.
Parameters:data - The array to wrap.
-
public void reset([ParsableByteArray](ParsableByteArray.html "class in com.google.android.exoplayer2.util")parsableByteArray)
Deprecated.
Sets this instance's data, position and limit to match the provided parsableByteArray. Any modifications to the underlying data array will be visible in both instances
Parameters:parsableByteArray - The ParsableByteArray.
-
public void reset(byte[] data,
int limit)
Deprecated.
Updates the instance to wrap data, and resets the position to zero.
Parameters:data - The array to wrap.limit - The limit in bytes.
-
public int bitsLeft()
Deprecated.
Returns the number of bits yet to be read.
-
public int getPosition()
Deprecated.
Returns the current bit offset.
-
public int getBytePosition()
Deprecated.
Returns the current byte offset. Must only be called when the position is byte aligned.
Throws:IllegalStateException - If the position isn't byte aligned.
-
public void setPosition(int position)
Deprecated.
Sets the current bit offset.
Parameters:position - The position to set.
-
public void skipBit()
Deprecated.
Skips a single bit.
-
public void skipBits(int numBits)
Deprecated.
Skips bits and moves current reading position forward.
Parameters:numBits - The number of bits to skip.
-
public boolean readBit()
Deprecated.
Reads a single bit. Returns:Whether the bit is set.
-
public int readBits(int numBits)
Deprecated.
Reads up to 32 bits.
Parameters:numBits - The number of bits to read.Returns:An integer whose bottom numBits bits hold the read data.
-
public long readBitsToLong(int numBits)
Deprecated.
Reads up to 64 bits.
Parameters:numBits - The number of bits to read.Returns:A long whose bottom numBits bits hold the read data.
-
public void readBits(byte[] buffer,
int offset,
int numBits)
Deprecated.
Reads numBits bits into buffer.
Parameters:buffer - The array into which the read data should be written. The trailing numBits % 8 bits are written into the most significant bits of the last modified buffer byte. The remaining ones are unmodified.offset - The offset in buffer at which the read data should be written.numBits - The number of bits to read.
-
public void byteAlign()
Deprecated.
Aligns the position to the next byte boundary. Does nothing if the position is already aligned.
-
public void readBytes(byte[] buffer,
int offset,
int length)
Deprecated.
Reads the next length bytes into buffer. Must only be called when the position is byte aligned.
Parameters:buffer - The array into which the read data should be written.offset - The offset in buffer at which the read data should be written.length - The number of bytes to read.Throws:IllegalStateException - If the position isn't byte aligned.See Also:System.arraycopy(Object, int, Object, int, int)
-
public void skipBytes(int length)
Deprecated.
Skips the next length bytes. Must only be called when the position is byte aligned.
Parameters:length - The number of bytes to read.Throws:IllegalStateException - If the position isn't byte aligned.
-
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readBytesAsString(int length)
Deprecated.
Reads the next length bytes as a UTF-8 string. Must only be called when the position is byte aligned.
Parameters:length - The number of bytes to read.Returns:The string encoded by the bytes in UTF-8.
-
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readBytesAsString(int length,[Charset](https://developer.android.com/reference/java/nio/charset/Charset.html "class or interface in java.nio.charset")charset)
Deprecated.
Reads the next length bytes as a string encoded in Charset. Must only be called when the position is byte aligned.
Parameters:length - The number of bytes to read.charset - The character set of the encoded characters.Returns:The string encoded by the bytes in the specified character set.
-
public void putInt(int value,
int numBits)
Deprecated.
Overwrites numBits from this array using the numBits least significant bits from value. Bits are written in order from most significant to least significant. The read position is advanced by numBits.
Parameters:value - The integer whose numBits least significant bits are written into data.numBits - The number of bits to write.