docs/doc/reference/com/google/android/exoplayer2/util/ParsableByteArray.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 classParsableByteArrayextends[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 a set of methods for parsing data from it. Numerical values are parsed with the assumption that their constituent bytes are in big endian order.
Constructors | Constructor | Description |
| --- | --- |
| ParsableByteArray() |
Deprecated.
Creates a new instance that initially has no backing data.
|
| ParsableByteArray(byte[] data) |
Deprecated.
Creates a new instance wrapping data, and sets the limit to data.length.
|
| ParsableByteArray(byte[] data, int limit) |
Deprecated.
Creates a new instance that wraps an existing array.
|
| ParsableByteArray(int limit) |
Deprecated.
Creates a new instance with limit bytes and sets the limit.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| int | bytesLeft() |
Deprecated.
Returns the number of bytes yet to be read.
|
| int | capacity() |
Deprecated.
Returns the capacity of the array, which may be larger than the limit.
|
| void | ensureCapacity(int requiredCapacity) |
Deprecated.
Ensures the backing array is at least requiredCapacity long.
|
| byte[] | getData() |
Deprecated.
Returns the underlying array.
|
| int | getPosition() |
Deprecated.
Returns the current offset in the array, in bytes.
|
| int | limit() |
Deprecated.
Returns the limit.
|
| char | peekChar() |
Deprecated.
Peeks at the next char.
|
| char | peekChar(Charset charset) |
Deprecated.
Peeks at the next char (as decoded by charset)
|
| int | peekUnsignedByte() |
Deprecated.
Peeks at the next byte as an unsigned value.
|
| void | readBytes(byte[] buffer, int offset, int length) |
Deprecated.
Reads the next length bytes into buffer at offset.
|
| void | readBytes(ParsableBitArray bitArray, int length) |
Deprecated.
Reads the next length bytes into bitArray, and resets the position of bitArray to zero.
|
| void | readBytes(ByteBuffer buffer, int length) |
Deprecated.
Reads the next length bytes into buffer.
|
| String | readDelimiterTerminatedString(char delimiter) |
Deprecated.
Reads up to the next delimiter byte (or the limit) as UTF-8 characters.
|
| double | readDouble() |
Deprecated.
Reads the next eight bytes as a 64-bit floating point value.
|
| float | readFloat() |
Deprecated.
Reads the next four bytes as a 32-bit floating point value.
|
| int | readInt() |
Deprecated.
Reads the next four bytes as a signed value
|
| int | readInt24() |
Deprecated.
Reads the next three bytes as a signed value.
|
| String | readLine() |
Deprecated.
Reads a line of text in UTF-8.
|
| String | readLine(Charset charset) |
Deprecated.
Reads a line of text in charset.
|
| int | readLittleEndianInt() |
Deprecated.
Reads the next four bytes as a signed value in little endian order.
|
| int | readLittleEndianInt24() |
Deprecated.
Reads the next three bytes as a signed value in little endian order.
|
| long | readLittleEndianLong() |
Deprecated.
Reads the next eight bytes as a signed value in little endian order.
|
| short | readLittleEndianShort() |
Deprecated.
Reads the next two bytes as a signed value.
|
| long | readLittleEndianUnsignedInt() |
Deprecated.
Reads the next four bytes as an unsigned value in little endian order.
|
| int | readLittleEndianUnsignedInt24() |
Deprecated.
Reads the next three bytes as an unsigned value in little endian order.
|
| int | readLittleEndianUnsignedIntToInt() |
Deprecated.
Reads the next four bytes as a little endian unsigned integer into an integer, if the top bit is a zero.
|
| int | readLittleEndianUnsignedShort() |
Deprecated.
Reads the next two bytes as an unsigned value.
|
| long | readLong() |
Deprecated.
Reads the next eight bytes as a signed value.
|
| String | readNullTerminatedString() |
Deprecated.
Reads up to the next NUL byte (or the limit) as UTF-8 characters.
|
| String | readNullTerminatedString(int length) |
Deprecated.
Reads the next length bytes as UTF-8 characters.
|
| short | readShort() |
Deprecated.
Reads the next two bytes as a signed value.
|
| String | readString(int length) |
Deprecated.
Reads the next length bytes as UTF-8 characters.
|
| String | readString(int length, Charset charset) |
Deprecated.
Reads the next length bytes as characters in the specified Charset.
|
| int | readSynchSafeInt() |
Deprecated.
Reads a Synchsafe integer.
|
| int | readUnsignedByte() |
Deprecated.
Reads the next byte as an unsigned value.
|
| int | readUnsignedFixedPoint1616() |
Deprecated.
Reads the next four bytes, returning the integer portion of the fixed point 16.16 integer.
|
| long | readUnsignedInt() |
Deprecated.
Reads the next four bytes as an unsigned value.
|
| int | readUnsignedInt24() |
Deprecated.
Reads the next three bytes as an unsigned value.
|
| int | readUnsignedIntToInt() |
Deprecated.
Reads the next four bytes as an unsigned integer into an integer, if the top bit is a zero.
|
| long | readUnsignedLongToLong() |
Deprecated.
Reads the next eight bytes as an unsigned long into a long, if the top bit is a zero.
|
| int | readUnsignedShort() |
Deprecated.
Reads the next two bytes as an unsigned value.
|
| long | readUtf8EncodedLong() |
Deprecated.
Reads a long value encoded by UTF-8 encoding
|
| Charset | readUtfCharsetFromBom() |
Deprecated.
Reads a UTF byte order mark (BOM) and returns the UTF Charset it represents.
|
| void | reset(byte[] data) |
Deprecated.
Updates the instance to wrap data, and resets the position to zero and the limit to data.length.
|
| void | reset(byte[] data, int limit) |
Deprecated.
Updates the instance to wrap data, and resets the position to zero.
|
| void | reset(int limit) |
Deprecated.
Resets the position to zero and the limit to the specified value.
|
| void | setLimit(int limit) |
Deprecated.
Sets the limit.
|
| void | setPosition(int position) |
Deprecated.
Sets the reading offset in the array.
|
| void | skipBytes(int bytes) |
Deprecated.
Moves the reading offset by bytes.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public ParsableByteArray()
Deprecated.
Creates a new instance that initially has no backing data.
-
public ParsableByteArray(int limit)
Deprecated.
Creates a new instance with limit bytes and sets the limit.
Parameters:limit - The limit to set.
-
public ParsableByteArray(byte[] data)
Deprecated.
Creates a new instance wrapping data, and sets the limit to data.length.
Parameters:data - The array to wrap.
-
public ParsableByteArray(byte[] data,
int limit)
Deprecated.
Creates a new instance that wraps an existing array.
Parameters:data - The data to wrap.limit - The limit to set.
-
public void reset(int limit)
Deprecated.
Resets the position to zero and the limit to the specified value. This might replace or wipe the underlying array, potentially invalidating any local references.
Parameters:limit - The limit to set.
-
public void reset(byte[] data)
Deprecated.
Updates the instance to wrap data, and resets the position to zero and the limit to data.length.
Parameters:data - The array to wrap.
-
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 to set.
-
public void ensureCapacity(int requiredCapacity)
Deprecated.
Ensures the backing array is at least requiredCapacity long.
position, limit, and all data in the underlying array (including that beyond limit()) are preserved.
This might replace or wipe the underlying array, potentially invalidating any local references.
-
public int bytesLeft()
Deprecated.
Returns the number of bytes yet to be read.
-
public int limit()
Deprecated.
Returns the limit.
-
public void setLimit(int limit)
Deprecated.
Sets the limit.
Parameters:limit - The limit to set.
-
public int getPosition()
Deprecated.
Returns the current offset in the array, in bytes.
-
public void setPosition(int position)
Deprecated.
Sets the reading offset in the array.
Parameters:position - Byte offset in the array from which to read.Throws:IllegalArgumentException - Thrown if the new position is neither in nor at the end of the array.
-
public byte[] getData()
Deprecated.
Returns the underlying array.
Changes to this array are reflected in the results of the read...() methods.
This reference must be assumed to become invalid when reset(int) or ensureCapacity(int) are called (because the array might get reallocated).
-
public int capacity()
Deprecated.
Returns the capacity of the array, which may be larger than the limit.
-
public void skipBytes(int bytes)
Deprecated.
Moves the reading offset by bytes.
Parameters:bytes - The number of bytes to skip.Throws:IllegalArgumentException - Thrown if the new position is neither in nor at the end of the array.
-
public void readBytes([ParsableBitArray](ParsableBitArray.html "class in com.google.android.exoplayer2.util")bitArray,
int length)
Deprecated.
Reads the next length bytes into bitArray, and resets the position of bitArray to zero.
Parameters:bitArray - The ParsableBitArray into which the bytes should be read.length - The number of bytes to write.
-
public void readBytes(byte[] buffer,
int offset,
int length)
Deprecated.
Reads the next length bytes into buffer at offset.
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.See Also:System.arraycopy(Object, int, Object, int, int)
-
public void readBytes([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")buffer,
int length)
Deprecated.
Reads the next length bytes into buffer.
Parameters:buffer - The ByteBuffer into which the read data should be written.length - The number of bytes to read.See Also:ByteBuffer.put(byte[], int, int)
-
public int peekUnsignedByte()
Deprecated.
Peeks at the next byte as an unsigned value.
-
public char peekChar()
Deprecated.
Peeks at the next char.
Equivalent to passing Charsets.UTF_16 or Charsets.UTF_16BE to peekChar(Charset).
-
public char peekChar([Charset](https://developer.android.com/reference/java/nio/charset/Charset.html "class or interface in java.nio.charset")charset)
Deprecated.
Peeks at the next char (as decoded by charset)
Throws:IllegalArgumentException - if charset is not supported. Only US_ASCII, UTF-8, UTF-16, UTF-16BE, and UTF-16LE are supported.
-
public int readUnsignedByte()
Deprecated.
Reads the next byte as an unsigned value.
-
public int readUnsignedShort()
Deprecated.
Reads the next two bytes as an unsigned value.
-
public int readLittleEndianUnsignedShort()
Deprecated.
Reads the next two bytes as an unsigned value.
-
public short readShort()
Deprecated.
Reads the next two bytes as a signed value.
-
public short readLittleEndianShort()
Deprecated.
Reads the next two bytes as a signed value.
-
public int readUnsignedInt24()
Deprecated.
Reads the next three bytes as an unsigned value.
-
public int readInt24()
Deprecated.
Reads the next three bytes as a signed value.
-
public int readLittleEndianInt24()
Deprecated.
Reads the next three bytes as a signed value in little endian order.
-
public int readLittleEndianUnsignedInt24()
Deprecated.
Reads the next three bytes as an unsigned value in little endian order.
-
public long readUnsignedInt()
Deprecated.
Reads the next four bytes as an unsigned value.
-
public long readLittleEndianUnsignedInt()
Deprecated.
Reads the next four bytes as an unsigned value in little endian order.
-
public int readInt()
Deprecated.
Reads the next four bytes as a signed value
-
public int readLittleEndianInt()
Deprecated.
Reads the next four bytes as a signed value in little endian order.
-
public long readLong()
Deprecated.
Reads the next eight bytes as a signed value.
-
public long readLittleEndianLong()
Deprecated.
Reads the next eight bytes as a signed value in little endian order.
-
public int readUnsignedFixedPoint1616()
Deprecated.
Reads the next four bytes, returning the integer portion of the fixed point 16.16 integer.
-
public int readSynchSafeInt()
Deprecated.
Reads a Synchsafe integer.
Synchsafe integers keep the highest bit of every byte zeroed. A 32 bit synchsafe integer can store 28 bits of information.
Returns:The parsed value.
-
public int readUnsignedIntToInt()
Deprecated.
Reads the next four bytes as an unsigned integer into an integer, if the top bit is a zero.
Throws:IllegalStateException - Thrown if the top bit of the input data is set.
-
public int readLittleEndianUnsignedIntToInt()
Deprecated.
Reads the next four bytes as a little endian unsigned integer into an integer, if the top bit is a zero.
Throws:IllegalStateException - Thrown if the top bit of the input data is set.
-
public long readUnsignedLongToLong()
Deprecated.
Reads the next eight bytes as an unsigned long into a long, if the top bit is a zero.
Throws:IllegalStateException - Thrown if the top bit of the input data is set.
-
public float readFloat()
Deprecated.
Reads the next four bytes as a 32-bit floating point value.
-
public double readDouble()
Deprecated.
Reads the next eight bytes as a 64-bit floating point value.
-
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readString(int length)
Deprecated.
Reads the next length bytes as UTF-8 characters.
Parameters:length - The number of bytes to read.Returns:The string encoded by the bytes.
-
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readString(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 characters in the specified Charset.
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[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readNullTerminatedString(int length)
Deprecated.
Reads the next length bytes as UTF-8 characters. A terminating NUL byte is discarded, if present.
Parameters:length - The number of bytes to read.Returns:The string, not including any terminating NUL byte.
-
@Nullable
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readNullTerminatedString()
Deprecated.
Reads up to the next NUL byte (or the limit) as UTF-8 characters. Returns:The string not including any terminating NUL byte, or null if the end of the data has already been reached.
-
@Nullable
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readDelimiterTerminatedString(char delimiter)
Deprecated.
Reads up to the next delimiter byte (or the limit) as UTF-8 characters. Returns:The string not including any terminating delimiter byte, or null if the end of the data has already been reached.
-
@Nullable
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readLine()
Deprecated.
Reads a line of text in UTF-8.
Equivalent to passing Charsets.UTF_8 to readLine(Charset).
-
@Nullable
public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")readLine([Charset](https://developer.android.com/reference/java/nio/charset/Charset.html?is-external=true "class or interface in java.nio.charset")charset)
Deprecated.
Reads a line of text in charset.
A line is considered to be terminated by any one of a carriage return ('\r'), a line feed ('\n'), or a carriage return followed immediately by a line feed ('\r\n'). This method discards leading UTF byte order marks (BOM), if present.
The position is advanced to start of the next line (i.e. any line terminators are skipped).
Parameters:charset - The charset used to interpret the bytes as a String.Returns:The line not including any line-termination characters, or null if the end of the data has already been reached.Throws:IllegalArgumentException - if charset is not supported. Only US_ASCII, UTF-8, UTF-16, UTF-16BE, and UTF-16LE are supported.
-
public long readUtf8EncodedLong()
Deprecated.
Reads a long value encoded by UTF-8 encoding
Returns:Decoded long valueThrows:NumberFormatException - if there is a problem with decoding
-
@Nullable
public[Charset](https://developer.android.com/reference/java/nio/charset/Charset.html "class or interface in java.nio.charset")readUtfCharsetFromBom()
Deprecated.
Reads a UTF byte order mark (BOM) and returns the UTF Charset it represents. Returns null without advancing position if no BOM is found.