Skip to content

Writer

1 min read

Import: import system.io;

Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.

Writer

Byte output with partial writes and explicit flushing.

public interface Writer

write

Accepts up to the supplied bytes and returns the number accepted. Empty input makes no progress; failures do not undo bytes already written.

unique fun write(data: byte[]): Result<int, IoError>

flush

Delivers buffered output to the underlying destination and reports failures. Flushing does not imply durable storage or close the destination.

unique fun flush(): Result<Unit, IoError>

write_all

Retries partial writes until all bytes are accepted; rejects zero or invalid progress. A failure leaves any completed writes in effect; this does not flush.

public fun write_all(data: byte[]): Result<Unit, IoError>