Stay organized with collections
Save and categorize content based on your preferences.
interface SeekableInputReader : MediaParser.InputReader
InputReader
that allows setting the read position.
Summary
Public methods |
abstract Unit |
Sets the read position at the given position .
|
Inherited functions |
From class InputReader
Long |
getLength()
Returns the length of the input in bytes, or -1 if the length is unknown.
|
Long |
getPosition()
Returns the current read position (byte offset) in the stream.
|
Int |
read(buffer: ByteArray, offset: Int, readLength: Int)
Reads up to readLength bytes of data and stores them into buffer , starting at index offset .
This method blocks until at least one byte is read, the end of input is detected, or an exception is thrown. The read position advances to the first unread byte.
|
|
Public methods
seekToPosition
abstract fun seekToPosition(position: Long): Unit
Sets the read position at the given position
.
advance
will immediately return after calling this method.
Parameters |
position |
Long: The position to seek to, in bytes. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# MediaParser.SeekableInputReader\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSeekableInputReader\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/MediaParser.SeekableInputReader \"View this page in Java\") \n\n```\ninterface SeekableInputReader : MediaParser.InputReader\n```\n\n|----------------------------------------------------|\n| [android.media.MediaParser.SeekableInputReader](#) |\n\n[InputReader](/reference/kotlin/android/media/MediaParser.InputReader) that allows setting the read position.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [seekToPosition](#seekToPosition(kotlin.Long))`(`position:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the read position at the given `position`. |\n\n| Inherited functions ||\n|---|---|\n| From class [InputReader](/reference/kotlin/android/media/MediaParser.InputReader) |------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getLength](/reference/kotlin/android/media/MediaParser.InputReader#getLength())`()` Returns the length of the input in bytes, or -1 if the length is unknown. \u003cbr /\u003e | | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getPosition](/reference/kotlin/android/media/MediaParser.InputReader#getPosition())`()` Returns the current read position (byte offset) in the stream. \u003cbr /\u003e | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [read](/reference/kotlin/android/media/MediaParser.InputReader#read(kotlin.ByteArray,%20kotlin.Int,%20kotlin.Int))`(`buffer:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`, `offset:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `readLength:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Reads up to `readLength` bytes of data and stores them into `buffer`, starting at index `offset`. This method blocks until at least one byte is read, the end of input is detected, or an exception is thrown. The read position advances to the first unread byte. \u003cbr /\u003e | ||\n\nPublic methods\n--------------\n\n### seekToPosition\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun seekToPosition(position: Long): Unit\n```\n\nSets the read position at the given `position`.\n\n[advance](/reference/kotlin/android/media/MediaParser#advance(android.media.MediaParser.SeekableInputReader)) will immediately return after calling this method.\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------------------------------|\n| `position` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The position to seek to, in bytes. |"]]