FileInputStream

class FileInputStream(val filePtr: FilePtr) : InputStream

Implementation of a FileInputStream based upon native file access.

Constructors

Link copied to clipboard
constructor(fileHandle: Int, mode: FileMode = Mode.READ)

Create an input stream for a file handle. Will create the needed file pointer.

constructor(pathName: String, mode: FileMode = Mode.READ)

Create an input stream for a file name. Will create the needed file pointer.

constructor(filePtr: FilePtr)

Directly wrap (and take ownership of) the file pointer given.

Types

Link copied to clipboard

Supported read modes.

Properties

Link copied to clipboard
open override val eof: Boolean

Determine whether the end of the file has been reached.

Link copied to clipboard

A pointer to the underlying file.

Functions

Link copied to clipboard
open override fun close()

Close the file (neither this object is valid afterwards, nor the pointer.

Link copied to clipboard
open override fun read(): Int

Read a single byte value. This is not buffered in any way, and possibly slow.

open override fun <T> read(buffer: <Error class: unknown class><T>, size: SizeT, bufferSize: SizeT): SizeT

Read into the given native buffer. It will check for errors, but does not indicate end of file.

open override fun read(buffer: ByteArray, offset: Int, len: Int): Int
fun read(buffer: UByteArray, offset: Int = 0, len: Int = buffer.size - offset): Int

Read an array of bytes from the file.

actual open fun read(b: ByteArray): Int