ForwardingExtractorInput
@UnstableApi
class ForwardingExtractorInput : ExtractorInput
An overridable ExtractorInput implementation forwarding all methods to another input.
Summary
Public constructors |
|---|
ForwardingExtractorInput(input: ExtractorInput!) |
Public functions |
|
|---|---|
Unit |
advancePeekPosition(length: Int)Advances the peek position by |
Boolean |
advancePeekPosition(length: Int, allowEndOfInput: Boolean)Advances the peek position by |
Long |
Returns the length of the source stream, or |
Long |
Returns the current peek position (byte offset) in the stream. |
Long |
Returns the current read position (byte offset) in the stream. |
Int |
Peeks up to |
Unit |
Equivalent to |
Boolean |
Like |
Int |
Reads up to |
Unit |
Equivalent to |
Boolean |
Like |
Unit |
Resets the peek position to equal the current read position. |
Unit |
<E : Throwable?> setRetryPosition(position: Long, e: E!)Called when reading fails and the required retry position is different from the last position. |
Int |
Like |
Unit |
Like |
Boolean |
Like |
Public constructors
Public functions
advancePeekPosition
fun advancePeekPosition(length: Int): Unit
Advances the peek position by length bytes. Like peekFully except the data is skipped instead of read.
| Parameters | |
|---|---|
length: Int |
The number of bytes to peek from the input. |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered. |
java.io.IOException |
If an error occurs peeking from the input. |
advancePeekPosition
fun advancePeekPosition(length: Int, allowEndOfInput: Boolean): Boolean
Advances the peek position by length bytes. Like peekFully except the data is skipped instead of read.
| Parameters | |
|---|---|
length: Int |
The number of bytes by which to advance the peek position. |
allowEndOfInput: Boolean |
True if encountering the end of the input before advancing is allowed, and should result in |
| Returns | |
|---|---|
Boolean |
True if advancing the peek position was successful. False if |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered having partially advanced (i.e. having advanced by at least one byte, but fewer than |
java.io.IOException |
If an error occurs advancing the peek position. |
getLength
fun getLength(): Long
Returns the length of the source stream, or LENGTH_UNSET if it is unknown.
| Returns | |
|---|---|
Long |
The length of the source stream, or |
getPeekPosition
fun getPeekPosition(): Long
Returns the current peek position (byte offset) in the stream.
| Returns | |
|---|---|
Long |
The peek position (byte offset) in the stream. |
getPosition
fun getPosition(): Long
Returns the current read position (byte offset) in the stream.
| Returns | |
|---|---|
Long |
The read position (byte offset) in the stream. |
peek
fun peek(target: ByteArray!, offset: Int, length: Int): Int
Peeks up to length bytes from the peek position. The current read position is left unchanged.
This method blocks until at least one byte of data can be peeked, the end of the input is detected, or an exception is thrown.
Calling resetPeekPosition resets the peek position to equal the current read position, so the caller can peek the same data again. Reading or skipping also resets the peek position.
| Parameters | |
|---|---|
target: ByteArray! |
A target array into which data should be written. |
offset: Int |
The offset into the target array at which to write. |
length: Int |
The maximum number of bytes to peek from the input. |
| Returns | |
|---|---|
Int |
The number of bytes peeked, or |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs peeking from the input. |
peekFully
fun peekFully(target: ByteArray!, offset: Int, length: Int): Unit
Equivalent to peekFully(target, offset, length, false).
| Parameters | |
|---|---|
target: ByteArray! |
A target array into which data should be written. |
offset: Int |
The offset into the target array at which to write. |
length: Int |
The number of bytes to peek from the input. |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered. |
java.io.IOException |
If an error occurs peeking from the input. |
peekFully
fun peekFully(
target: ByteArray!,
offset: Int,
length: Int,
allowEndOfInput: Boolean
): Boolean
Like peek, but peeks the requested length in full.
| Parameters | |
|---|---|
target: ByteArray! |
A target array into which data should be written. |
offset: Int |
The offset into the target array at which to write. |
length: Int |
The number of bytes to peek from the input. |
allowEndOfInput: Boolean |
True if encountering the end of the input having peeked no data is allowed, and should result in |
| Returns | |
|---|---|
Boolean |
True if the peek was successful. False if |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered having partially satisfied the peek (i.e. having peeked at least one byte, but fewer than |
java.io.IOException |
If an error occurs peeking from the input. |
read
fun read(buffer: ByteArray!, offset: Int, length: Int): Int
Reads up to length bytes from the input and resets the peek position.
This method blocks until at least one byte of data can be read, the end of the input is detected, or an exception is thrown.
| Parameters | |
|---|---|
buffer: ByteArray! |
A target array into which data should be written. |
offset: Int |
The offset into the target array at which to write. |
length: Int |
The maximum number of bytes to read from the input. |
| Returns | |
|---|---|
Int |
The number of bytes read, or |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs reading from the input. |
readFully
fun readFully(target: ByteArray!, offset: Int, length: Int): Unit
Equivalent to readFully(target, offset, length, false).
| Parameters | |
|---|---|
target: ByteArray! |
A target array into which data should be written. |
offset: Int |
The offset into the target array at which to write. |
length: Int |
The number of bytes to read from the input. |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered. |
java.io.IOException |
If an error occurs reading from the input. |
readFully
fun readFully(
target: ByteArray!,
offset: Int,
length: Int,
allowEndOfInput: Boolean
): Boolean
Like read, but reads the requested length in full.
| Parameters | |
|---|---|
target: ByteArray! |
A target array into which data should be written. |
offset: Int |
The offset into the target array at which to write. |
length: Int |
The number of bytes to read from the input. |
allowEndOfInput: Boolean |
True if encountering the end of the input having read no data is allowed, and should result in |
| Returns | |
|---|---|
Boolean |
True if the read was successful. False if |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered having partially satisfied the read (i.e. having read at least one byte, but fewer than |
java.io.IOException |
If an error occurs reading from the input. |
resetPeekPosition
fun resetPeekPosition(): Unit
Resets the peek position to equal the current read position.
setRetryPosition
fun <E : Throwable?> setRetryPosition(position: Long, e: E!): Unit
Called when reading fails and the required retry position is different from the last position. After setting the retry position it throws the given Throwable.
| Parameters | |
|---|---|
<E : Throwable?> |
Type of |
position: Long |
The required retry position. |
e: E! |
|
| Throws | |
|---|---|
E |
The given |
androidx.media3.extractor.ForwardingExtractorInput |
skip
fun skip(length: Int): Int
Like read, except the data is skipped instead of read.
| Parameters | |
|---|---|
length: Int |
The maximum number of bytes to skip from the input. |
| Returns | |
|---|---|
Int |
The number of bytes skipped, or |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs reading from the input. |
skipFully
fun skipFully(length: Int): Unit
Like readFully, except the data is skipped instead of read.
Encountering the end of input is always considered an error, and will result in an EOFException being thrown.
| Parameters | |
|---|---|
length: Int |
The number of bytes to skip from the input. |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered. |
java.io.IOException |
If an error occurs reading from the input. |
skipFully
fun skipFully(length: Int, allowEndOfInput: Boolean): Boolean
Like readFully, except the data is skipped instead of read.
| Parameters | |
|---|---|
length: Int |
The number of bytes to skip from the input. |
allowEndOfInput: Boolean |
True if encountering the end of the input having skipped no data is allowed, and should result in |
| Returns | |
|---|---|
Boolean |
True if the skip was successful. False if |
| Throws | |
|---|---|
java.io.EOFException |
If the end of input was encountered having partially satisfied the skip (i.e. having skipped at least one byte, but fewer than |
java.io.IOException |
If an error occurs reading from the input. |