# SeekableMuxerOutput

Artifact: [androidx.media3:media3-muxer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/muxer/SeekableMuxerOutput.java+class:androidx.media3.muxer.SeekableMuxerOutput)

*** ** * ** ***


```
@UnstableApi
interface SeekableMuxerOutput : WritableByteChannel
```

<br />

Known direct subclasses [FileOutputStreamSeekableMuxerOutput](https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput` | An implementation of `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput` that writes to a `https://developer.android.com/reference/java/io/FileOutputStream.html`. |

*** ** * ** ***

A seekable target for `https://developer.android.com/reference/kotlin/androidx/media3/muxer/Muxer` output.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput#getPosition()()` Returns the current position in the output. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput#getSize()()` Returns the total size of the output. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput!` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput#of(java.io.FileOutputStream)(fileOutputStream: https://developer.android.com/reference/java/io/FileOutputStream.html!)` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput` from the given `https://developer.android.com/reference/java/io/FileOutputStream.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput!` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput#of(java.lang.String)(filePath: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput` from the given file path. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput!` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput#of(android.os.ParcelFileDescriptor)(pfd: https://developer.android.com/reference/android/os/ParcelFileDescriptor.html!)` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput` from the given `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput#setPosition(long)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the current position in the output for subsequent `https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html#write(java.nio.ByteBuffer)` operations. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput#truncate(long)(size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Truncates the output to the specified size. |

### Inherited functions

From [java.nio.channels.Channel](https://developer.android.com/reference/java/nio/channels/Channel.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/java/nio/channels/Channel.html#close()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/java/nio/channels/Channel.html#isOpen()()` From [java.nio.channels.WritableByteChannel](https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html#write(java.nio.ByteBuffer)(p: https://developer.android.com/reference/java/nio/ByteBuffer.html!)`

## Public functions

### getPosition

```
fun getPosition(): Long
```

Returns the current position in the output.

This refers to the byte offset at which bytes will be written on the next `https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html#write(java.nio.ByteBuffer)` call.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The current position in bytes from the beginning of the output. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurs while getting the position. |

### getSize

```
fun getSize(): Long
```

Returns the total size of the output.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The total size of the output in bytes. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurs while getting the size. |

### of

```
java-static fun of(fileOutputStream: FileOutputStream!): SeekableMuxerOutput!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput` from the given `https://developer.android.com/reference/java/io/FileOutputStream.html`.

### of

```
java-static fun of(filePath: String!): SeekableMuxerOutput!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput` from the given file path.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException.html` |   |

### of

```
java-static fun of(pfd: ParcelFileDescriptor!): SeekableMuxerOutput!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput` from the given `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`.

The caller transfers ownership of the `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` to the returned `https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput`. The descriptor is automatically closed when `https://developer.android.com/reference/java/nio/channels/Channel.html#close()` is called.

| Parameters |
|---|---|
| `pfd: https://developer.android.com/reference/android/os/ParcelFileDescriptor.html!` | the `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` to write output to |

### setPosition

```
fun setPosition(position: Long): Unit
```

Sets the current position in the output for subsequent `https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html#write(java.nio.ByteBuffer)` operations.

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The new position in bytes from the beginning of the output. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurs while setting the position. |

### truncate

```
fun truncate(size: Long): Unit
```

Truncates the output to the specified size.

If the current position (for writing) is beyond the new size, it is set to the new size.

| Parameters |
|---|---|
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The new size of the output in bytes. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurs while truncating the output. |