FileStream

expect sealed interface FileStream : Closeable(source)

A stream for a File.

NOTE: Implementations are thread-safe.

See also

Inheritors

actual interface FileStream : Closeable(source)

Inheritors

actual interface FileStream : Closeable(source)

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
expect sealed interface Read : FileStream

A FileStream for read-only operations whereby the source of data is a File.

actual interface Read : FileStream
actual interface Read : FileStream, ReadableByteChannel
actual interface Read : FileStream
Link copied to clipboard

A FileStream for read/write operations whereby the source/destination of data is a File.

Link copied to clipboard
expect sealed interface Write : FileStream

A FileStream for write-only operations whereby the destination for data is a File.

actual interface Write : FileStream
actual interface Write : FileStream

Functions

Link copied to clipboard
expect abstract override fun close()

Closes the FileStream resource, pushing all potentially buffered data to the underlying File for which this stream belongs. Subsequent invocations do nothing.

actual abstract override fun close()

Closes the resource releasing any system resources that may be allocated to this Closeable. Subsequent invocations do nothing.

actual abstract override fun close()
actual abstract override fun close()

Closes the resource releasing any system resources that may be allocated to this Closeable. Subsequent invocations do nothing.

Link copied to clipboard
open override fun flush()

Redirects to calling sync(meta = true).

Link copied to clipboard
expect abstract fun isOpen(): Boolean

Checks if this FileStream has been closed or not.

actual abstract fun isOpen(): Boolean
actual abstract override fun isOpen(): Boolean
actual abstract fun isOpen(): Boolean
Link copied to clipboard
expect abstract fun position(): Long

Retrieves the current position of the file pointer for which the next operation will occur at.

expect abstract fun position(new: Long): FileStream
actual abstract fun position(): Long
actual abstract fun position(new: Long): FileStream
actual abstract fun position(): Long
actual abstract fun position(new: Long): FileStream
actual abstract fun position(): Long
actual abstract fun position(new: Long): FileStream
Link copied to clipboard
expect abstract fun size(): Long

Retrieves the current size of the File for which this FileStream belongs.

actual abstract fun size(): Long
actual abstract fun size(): Long
actual abstract fun size(): Long
Link copied to clipboard
expect abstract fun sync(meta: Boolean): FileStream

Syncs any updates to the File for which this stream belongs, to the device filesystem. This is akin to fsync/fdatasync.

actual abstract fun sync(meta: Boolean): FileStream
actual abstract fun sync(meta: Boolean): FileStream
actual abstract fun sync(meta: Boolean): FileStream