public class FileOutputStream implements OutputStream
File-backed binary output stream.
Opening the stream truncates the target file unless append is requested. One buffered native file handle remains open until close; successive writes do not reopen the path.
import klyn.io
try stream = FilePath("payload.bin").openOutputStream():
stream.write("OK")| Modifier and Type | Member | Description |
|---|---|---|
| public | FileOutputStreamFileOutputStream(notnull path as Path, append as Boolean = false) |
Opens a binary file addressed by a Path, truncating by default. |
| public | FileOutputStreamFileOutputStream(notnull path as String, append as Boolean = false) |
Opens a binary file, truncating by default and retaining its buffered handle. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | closeclose() as Void throws IOException |
Performs a text or binary I/O operation. |
| public | flushflush() as Void |
Flushes buffered bytes to the OS; this is not a durable fsync guarantee. |
| public | seekseek(offset as Long) as Void |
Positions the file at an absolute byte offset; the next write may overwrite. |
| public | writewrite(value as String) as Void throws IOException |
Performs a text or binary I/O operation. |
| public | writeBytes | Writes a byte range directly from a reusable buffer without slicing it. |
| public | writeByteswriteBytes(value as Array<Byte>) as Void throws IOException |
Performs a text or binary I/O operation. |