public class FileInputStream implements InputStream
File-backed binary input stream.
import klyn.io
try stream = FilePath("payload.bin").openInputStream():
header = stream.readBytes(8)
print(header.size)| Modifier and Type | Member | Description |
|---|---|---|
| public | FileInputStreamFileInputStream(notnull path as String) |
Opens a regular file for buffered binary reading. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | closeclose() as Void throws IOException |
Performs a text or binary I/O operation. |
| public | readread() as String throws IOException |
Reads the remaining file contents as strict UTF-8, from the current byte position to end-of-file. |
| public | readBytesreadBytes(length as Long) as Array<Byte> throws IOException |
Performs a text or binary I/O operation. |
| public | readInto | Reads into an existing byte buffer without reopening the file or allocating another buffer. |
| public | seekseek(offset as Long) as Void |
Positions the open file at an absolute byte offset, including after EOF. |