Read

expect sealed interface Read : FileStream(source)

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

See also

Inheritors

actual interface Read : FileStream(source)

Inheritors

Inheritors

actual interface Read : FileStream(source)

Inheritors

Functions

Link copied to clipboard
@JvmStatic
fun FileStream.Read.asInputStream(closeParentOnClose: Boolean): InputStream

Converts the provided Read stream to an InputStream.

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 override fun position(new: Long): FileStream.Read
actual abstract fun position(): Long
actual abstract override fun position(new: Long): FileStream.Read
actual abstract fun position(): Long
actual abstract override fun position(new: Long): FileStream.Read
actual abstract fun position(): Long
actual abstract override fun position(new: Long): FileStream.Read
Link copied to clipboard
expect abstract fun read(buf: ByteArray): Int
expect abstract fun read(buf: ByteArray, offset: Int, len: Int): Int

Reads data from the File for which this stream belongs, into the provided array. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

expect abstract fun read(buf: ByteArray, position: Long): Int
expect abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int

Reads data from the File for which this stream belongs, into the provided array. Bytes are read starting at the specified position. The FileStream.position will not be changed.

abstract fun read(buf: Buffer): Long
abstract fun read(buf: Buffer, offset: Long, len: Long): Long

Reads data from the File for which this stream belongs, into the provided buffer. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

actual abstract fun read(buf: ByteArray): Int
actual abstract fun read(buf: ByteArray, position: Long): Int
actual abstract fun read(buf: ByteArray, offset: Int, len: Int): Int
actual abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int
abstract fun read(buf: Buffer, position: Long): Long
abstract fun read(buf: Buffer, offset: Long, len: Long, position: Long): Long

Reads data from the File for which this stream belongs, into the provided buffer. Bytes are read starting at the specified position. The FileStream.position will not be changed.

abstract override fun read(dst: ByteBuffer?): Int

Reads data from the File for which this stream belongs, into the provided ByteBuffer. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

actual abstract fun read(buf: ByteArray): Int
actual abstract fun read(buf: ByteArray, position: Long): Int
actual abstract fun read(buf: ByteArray, offset: Int, len: Int): Int
actual abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int
abstract fun read(dst: ByteBuffer?, position: Long): Int

Reads data from the File for which this stream belongs, into the provided ByteBuffer. Bytes are read starting at the specified position. The FileStream.position will not be changed.

actual abstract fun read(buf: ByteArray): Int
actual abstract fun read(buf: ByteArray, position: Long): Int
actual abstract fun read(buf: ByteArray, offset: Int, len: Int): Int
actual abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int
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 override fun sync(meta: Boolean): FileStream.Read

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

actual abstract override fun sync(meta: Boolean): FileStream.Read
actual abstract override fun sync(meta: Boolean): FileStream.Read
actual abstract override fun sync(meta: Boolean): FileStream.Read