# FileOutputStreamSeekableMuxerOutput

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/FileOutputStreamSeekableMuxerOutput.java+class:androidx.media3.muxer.FileOutputStreamSeekableMuxerOutput)

*** ** * ** ***


```
@UnstableApi
class FileOutputStreamSeekableMuxerOutput : SeekableMuxerOutput
```

<br />

*** ** * ** ***

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`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput#FileOutputStreamSeekableMuxerOutput(java.io.FileOutputStream)(fileOutputStream: https://developer.android.com/reference/java/io/FileOutputStream.html!)` Creates an instance. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput#close()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput#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/FileOutputStreamSeekableMuxerOutput#getSize()()` Returns the total size of the output. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput#isOpen()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput#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/FileOutputStreamSeekableMuxerOutput#truncate(long)(size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Truncates the output to the specified size. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/muxer/FileOutputStreamSeekableMuxerOutput#write(java.nio.ByteBuffer)(src: https://developer.android.com/reference/java/nio/ByteBuffer.html!)` |

### Inherited functions

From [androidx.media3.muxer.SeekableMuxerOutput](https://developer.android.com/reference/kotlin/androidx/media3/muxer/SeekableMuxerOutput) `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`.

## Public constructors

### FileOutputStreamSeekableMuxerOutput

```
FileOutputStreamSeekableMuxerOutput(fileOutputStream: FileOutputStream!)
```

Creates an instance.

| Parameters |
|---|---|
| `fileOutputStream: https://developer.android.com/reference/java/io/FileOutputStream.html!` | The `https://developer.android.com/reference/java/io/FileOutputStream.html` to write output to. |

## Public functions

### close

```
fun close(): Unit
```

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

### 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. |

### isOpen

```
fun isOpen(): Boolean
```

### 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. |

### write

```
fun write(src: ByteBuffer!): Int
```

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