Axle v0.22.0
Package

std/io

std/io — byte-stream I/O in pure Axle over libc stdio.

InputStream / OutputStream — the byte-stream contracts.
File — a path facade (no open handle).
FileInputStream / FileOutputStream — libc-FILE*-backed byte streams.
ByteArrayInputStream / …OutputStream — in-memory streams.
BufferedReader / BufferedWriter / PrintWriter — text over a file stream.
Scanner — conventional stdin reader.

Polymorphism is at the trait boundary: a fn drain(s : InputStream)
accepts any concrete stream above. Streaming only: there is no
whole-file readAll / writeAll, so a large file never has to live in
memory at once. The open mode is one of the OPEN_READ / OPEN_WRITE /
OPEN_APPEND flags, never a text spelling, so I/O stays byte-exact.

Entry: the fs:: libc bindings and std/text byte bridges resolve
by cross-module use.
Exit: the classes above are declared and exported as std/io.

Free functions

TypeMethod and description
ptr
axle_libc_stdin() : ptr
ptr
asStream(handle : i64) : ptr View an i64 address (a stored FILE* handle, or a buffer address from
bufferAddr) as the opaque ptr the fs:: bindings expect.
i64
streamHandle(s : ptr) : i64 Materialise a libc FILE* ptr as the i64 handle a stream field holds.
i64
clampedTo(len : i64, capacity : i64) : i64 A byte count bounded to [0, capacity] — the range a stream may treat
as valid. A negative count reads as empty, and one past the buffer end
reads short rather than out of bounds. ByteArrayInputStream clamps its
length with it, so every later read, skip and available inherits the
bound once rather than each re-testing it.
i64
copy(src : InputStream, dst : OutputStream) : i64 Stream every remaining byte from src to dst through one fixed-size
buffer, so no more than that buffer is ever resident and a large source
is copied in constant memory. Takes any pair of concrete streams.

Method detail

#axle_libc_stdin

axle_libc_stdin() : ptr

#asStream

asStream(handle : i64) : ptr

View an i64 address (a stored FILE* handle, or a buffer address from
bufferAddr) as the opaque ptr the fs:: bindings expect.

#streamHandle

streamHandle(s : ptr) : i64

Materialise a libc FILE* ptr as the i64 handle a stream field holds.

#clampedTo

clampedTo(len : i64, capacity : i64) : i64

A byte count bounded to [0, capacity] — the range a stream may treat
as valid. A negative count reads as empty, and one past the buffer end
reads short rather than out of bounds. ByteArrayInputStream clamps its
length with it, so every later read, skip and available inherits the
bound once rather than each re-testing it.

#copy

copy(src : InputStream, dst : OutputStream) : i64 ! IOException

Stream every remaining byte from src to dst through one fixed-size
buffer, so no more than that buffer is ever resident and a large source
is copied in constant memory. Takes any pair of concrete streams.

Parameters
src stream drained from its current position to EOF
dst stream the bytes are written to
Returns total bytes copied
Throws
IOException if either stream raises one.

C class File

A File wraps a filesystem path and owns no open handle: each method
opens, operates and closes within its own scope, or hands back an open
stream the caller is responsible for closing. Content is streamed, so
there is no whole-file read/write shortcut.

Constructors

TypeMethod and description
constructor(path : string) Wrap a path; opens no handle until a method is called.

Method detail

#constructor

constructor(path : string)

Wrap a path; opens no handle until a method is called.

Parameters
path filesystem path the file operations target

Methods

TypeMethod and description
bool
exists(self) : bool Whether anything at all (file or directory) exists at this path — the
answer Path::exists gives to the same path.

Asked of the path's kind rather than by opening it: whether the path
names something is a question about the path, and a directory answers
it yes. Whether that something can be read is a later question, asked
by openRead.
i64
length(self) : i64 Size of the file in bytes; 0 if it cannot be opened or is
non-seekable. A directory is not a file and answers 0.
void
delete(self) : void Remove the file from disk.
FileInputStream
openRead(self) : FileInputStream Open the file for byte-exact reading at position 0.
FileOutputStream
openWrite(self) : FileOutputStream Open the file for byte-exact writing, truncating existing content.
FileOutputStream
openAppend(self) : FileOutputStream Open the file for byte-exact writing in append mode (creates if
absent).
void
close(self) : void A path wrapper holds no open handle, so close() is a no-op that
satisfies the Closeable contract.

Method detail

#exists

exists(self) : bool

Whether anything at all (file or directory) exists at this path — the
answer Path::exists gives to the same path.

Asked of the path's kind rather than by opening it: whether the path
names something is a question about the path, and a directory answers
it yes. Whether that something can be read is a later question, asked
by openRead.

#length

length(self) : i64

Size of the file in bytes; 0 if it cannot be opened or is
non-seekable. A directory is not a file and answers 0.

#delete

delete(self) : void ! IOException

Remove the file from disk.

Throws
IOException if the file cannot be removed.

#openRead

openRead(self) : FileInputStream ! FileNotFoundException

Open the file for byte-exact reading at position 0.

Returns a FileInputStream the caller must close
Throws
FileNotFoundException if the path cannot be opened.

#openWrite

openWrite(self) : FileOutputStream ! IOException

Open the file for byte-exact writing, truncating existing content.

Returns a FileOutputStream the caller must close
Throws
IOException if the path cannot be opened for writing.

#openAppend

openAppend(self) : FileOutputStream ! IOException

Open the file for byte-exact writing in append mode (creates if
absent).

Returns a FileOutputStream positioned past the last byte
Throws
IOException if the path cannot be opened for appending.

#close

close(self) : void ! IOException

A path wrapper holds no open handle, so close() is a no-op that
satisfies the Closeable contract.

C class FileInputStream

Byte-oriented read stream backed by a libc FILE*. Implements
InputStream, so it can be read as text via BufferedReader.

handle holds the FILE* as an i64 (0 once closed).

Constructors

TypeMethod and description
constructor(path : string) Open path for binary reading.

Method detail

#constructor

constructor(path : string) ! FileNotFoundException

Open path for binary reading.

Parameters
path filesystem path to open
Throws
FileNotFoundException if the path names no readable file.
A directory is reported by that same exception with its
own message: the open fails for either, and "file not found"
about a path that is right there sends the caller looking
for the wrong thing. The kind is asked only when the open
failed.

Methods

TypeMethod and description
FileInputStream
fromFile(file : File) : FileInputStream Open the file named by file.path for binary reading.
i32
read(self) : i32 Next byte 0..255, or -1 at EOF / once closed.
i64
readBytes(self, mut buf : i8[], offset : i64, len : i64) : i64 Read up to len bytes into buf[offset .. offset+len).
i64
skip(self, n : i64) : i64 Skip up to n bytes forward by seeking.
i64
available(self) : i64 Bytes remaining between the current position and EOF.
Returns 0 when closed.
void
close(mut self) : void Close the handle; idempotent once closed.

Method detail

#fromFile

fromFile(file : File) : FileInputStream ! FileNotFoundException

Open the file named by file.path for binary reading.

Parameters
file a File wrapper whose path is opened
Throws
FileNotFoundException if the path cannot be opened.

#read

read(self) : i32 ! IOException

Next byte 0..255, or -1 at EOF / once closed.

Throws
IOException never — the body raises nothing. fgetc answers
the EOF sentinel for a read error just as for end of file, so
a failure at this granularity is reported as -1 rather than
thrown; readBytes is where the two are told apart (feof).
The declared set mirrors the InputStream row.

#readBytes

readBytes(self, mut buf : i8[], offset : i64, len : i64) : i64 ! IOException

Read up to len bytes into buf[offset .. offset+len).

Parameters
buf destination buffer
offset first destination index
len maximum bytes to read
Returns bytes read, or -1 at EOF
Throws
IOException if the stream is closed or a read error occurs.

#skip

skip(self, n : i64) : i64 ! IOException

Skip up to n bytes forward by seeking.

Parameters
n maximum bytes to skip
Returns bytes actually skipped (may be less at EOF)
Throws
IOException if the stream is closed.

#available

available(self) : i64

Bytes remaining between the current position and EOF.
Returns 0 when closed.

#close

close(mut self) : void ! IOException

Close the handle; idempotent once closed.

C class FileOutputStream

Byte-oriented write stream backed by a libc FILE*. Implements
OutputStream, so it can be written as text via PrintWriter.

handle holds the FILE* as an i64 (0 once closed).

Constructors

TypeMethod and description
constructor(path : string, mode : FileOpenMode) Open path for binary writing.

Method detail

#constructor

constructor(path : string, mode : FileOpenMode) ! IOException

Open path for binary writing.

Parameters
path filesystem path to open
mode FileOpenMode::APPEND writes past the end;
any other mode truncates
Throws
IOException if the path cannot be opened.

Methods

TypeMethod and description
FileOutputStream
fromFile(file : File) : FileOutputStream Open the file named by file.path for binary writing (truncate).
void
write(self, b : i32) : void Write the low 8 bits of b as one byte.
void
writeBytes(self, buf : i8[], offset : i64, len : i64) : void Write buf[offset .. offset+len) to the stream.
void
flush(self) : void Flush libc's buffer to disk.
void
close(mut self) : void Flush then close the handle; idempotent once closed.

Method detail

#fromFile

fromFile(file : File) : FileOutputStream ! IOException

Open the file named by file.path for binary writing (truncate).

Parameters
file a File wrapper whose path is opened
Throws
IOException if the path cannot be opened.

#write

write(self, b : i32) : void ! IOException

Write the low 8 bits of b as one byte.

Parameters
b source value; only its low 8 bits are emitted
Throws
IOException if the stream is closed.

#writeBytes

writeBytes(self, buf : i8[], offset : i64, len : i64) : void ! IOException

Write buf[offset .. offset+len) to the stream.

Parameters
buf source buffer
offset first source index
len number of bytes to write
Throws
IOException if the stream is closed or a partial write occurs.

#flush

flush(self) : void ! IOException

Flush libc's buffer to disk.

#close

close(mut self) : void ! IOException

Flush then close the handle; idempotent once closed.

C class ByteArrayInputStream

In-memory read stream over an i8[] buffer. Pure Axle — no OS
handle. read() returns -1 at EOF without throwing (the -1 sentinel
matches the fgetc convention).

Fields: data is the backing buffer; cursor is the next-read
index; len is the number of valid bytes in data.

Constructors

TypeMethod and description
constructor(data : i8[], len : i64) Wrap data treating the first len bytes as the stream content.

Method detail

#constructor

constructor(data : i8[], len : i64)

Wrap data treating the first len bytes as the stream content.

Parameters
data backing buffer; not copied — the stream takes it and
releases it, so the caller's binding ends here
len number of valid bytes in data; a count past the
buffer end is clamped to it, so a miscount reads short
rather than out of bounds

Methods

TypeMethod and description
ByteArrayInputStream
fromString(s : string) : ByteArrayInputStream Build a ByteArrayInputStream from a string's byte content.
The bytes are copied into a fresh i8[] so the source string
can be freed independently.
i32
read(mut self) : i32 Next byte 0..255, or -1 at end of data (no throw).
i64
readBytes(mut self, mut buf : i8[], offset : i64, len : i64) : i64 Copy up to len bytes into buf[offset .. offset+len).
i64
skip(mut self, n : i64) : i64 Advance the cursor up to n bytes.
i64
available(self) : i64 Bytes remaining between the cursor and the end of the buffer.
Returns 0 at EOF.
void
reset(mut self) : void Rewind the cursor to byte 0.
void
close(self) : void No-op: no OS handle to release.

Method detail

#fromString

fromString(s : string) : ByteArrayInputStream

Build a ByteArrayInputStream from a string's byte content.
The bytes are copied into a fresh i8[] so the source string
can be freed independently.

Parameters
s source string; its bytes become the stream content

#read

read(mut self) : i32 ! IOException

Next byte 0..255, or -1 at end of data (no throw).

Returns byte value, or -1 at EOF

#readBytes

readBytes(mut self, mut buf : i8[], offset : i64, len : i64) : i64 ! IOException

Copy up to len bytes into buf[offset .. offset+len).

Parameters
buf destination buffer
offset first destination index
len maximum bytes to copy
Returns bytes copied, or -1 at EOF (0 when len is 0)
Throws
IOException if the window reaches past buf, which is a
caller miscount rather than a stream condition and so is
refused as the file streams refuse it.

#skip

skip(mut self, n : i64) : i64 ! IOException

Advance the cursor up to n bytes.

Parameters
n maximum bytes to skip
Returns bytes actually skipped
Throws
IOException never — present to satisfy the trait.

#available

available(self) : i64

Bytes remaining between the cursor and the end of the buffer.
Returns 0 at EOF.

#reset

reset(mut self) : void

Rewind the cursor to byte 0.

#close

close(self) : void ! IOException

No-op: no OS handle to release.

C class ByteArrayOutputStream

In-memory write stream backed by a growable i8[]. Pure Axle — no
OS handle.

buf is the backing store; len counts bytes written so far; cap
is the allocated capacity. __grow doubles capacity until the new
minimum fits. toByteArray / toString materialise the written
content; reset resets the write cursor without freeing the buffer.

Constructors

TypeMethod and description
constructor() Start with a 16-byte initial capacity; the buffer grows on demand.

Method detail

#constructor

constructor()

Start with a 16-byte initial capacity; the buffer grows on demand.

Methods

TypeMethod and description
void
write(mut self, b : i32) : void Append the low 8 bits of b as one byte.
void
writeBytes(mut self, buf : i8[], offset : i64, len : i64) : void Append buf[offset .. offset+len) to the stream.
void
flush(self) : void No-op: in-memory; nothing to flush to an OS sink.
void
close(self) : void No-op: no OS handle; the backing buffer is freed with the object.
i8[]
toByteArray(self) : i8[] Copy the written bytes into a fresh i8[].
string
toString(self) : string Materialise the written bytes as an owned UTF-8 string.

The backing store is handed to the seam directly: bytesToString
copies into a fresh allocation of its own, so an intermediate array
would only add a second allocation and a second pass over the bytes.
i64
size(self) : i64 Bytes written so far.
void
reset(mut self) : void Discard written bytes; keep the allocated capacity.

Method detail

#write

write(mut self, b : i32) : void ! IOException

Append the low 8 bits of b as one byte.

Parameters
b source value; only its low 8 bits are appended
Throws
IOException never — present to satisfy the trait.

#writeBytes

writeBytes(mut self, buf : i8[], offset : i64, len : i64) : void ! IOException

Append buf[offset .. offset+len) to the stream.

Parameters
buf source buffer
offset first source index
len number of bytes to copy in
Throws
IOException if the window reaches past buf, which is a
caller miscount rather than a stream condition and so is
refused as the file streams refuse it.

#flush

flush(self) : void ! IOException

No-op: in-memory; nothing to flush to an OS sink.

#close

close(self) : void ! IOException

No-op: no OS handle; the backing buffer is freed with the object.

#toByteArray

toByteArray(self) : i8[]

Copy the written bytes into a fresh i8[].

Returns a new array containing bytes 0 .. len-1

#toString

toString(self) : string

Materialise the written bytes as an owned UTF-8 string.

The backing store is handed to the seam directly: bytesToString
copies into a fresh allocation of its own, so an intermediate array
would only add a second allocation and a second pass over the bytes.

Returns a new string containing bytes 0 .. len-1

#size

size(self) : i64

Bytes written so far.

Returns count of bytes appended since construction or last reset

#reset

reset(mut self) : void

Discard written bytes; keep the allocated capacity.

C class BufferedReader

Line-oriented text reader over a FileInputStream. The usual pattern
is new BufferedReader(new FileInputStream(path)); the reader steals
the source stream's handle, leaving the source inert.

The bytes arrive a block at a time into buf; pos indexes the next
byte still unread in it and filled counts the bytes the last refill
actually produced, so the block's valid window is buf[pos .. filled).

Constructors

TypeMethod and description
constructor(input : FileInputStream) Take ownership of input's open handle. input is left inert and
must not be used afterwards.

Method detail

#constructor

constructor(input : FileInputStream)

Take ownership of input's open handle. input is left inert and
must not be used afterwards.

Parameters
input source stream whose open handle is taken over

Methods

TypeMethod and description
BufferedReader
open(path : string) : BufferedReader Open path for line-oriented reading directly, without a separate
FileInputStream. The usual one-liner.
bool
hasMoreLines(mut self) : bool Whether another byte is available before EOF, without consuming it.
string
readLine(mut self) : string Read one line (up to but excluding '\n'); "" at EOF. A '\r'
immediately followed by '\n' is a CRLF terminator and is dropped;
a lone '\r' is line content, as is a '\r' that ends the file.
void
close(mut self) : void Close the handle; idempotent once closed.

Method detail

#open

open(path : string) : BufferedReader ! FileNotFoundException

Open path for line-oriented reading directly, without a separate
FileInputStream. The usual one-liner.

Parameters
path filesystem path to open for reading
Throws
FileNotFoundException if the path cannot be opened.

#hasMoreLines

hasMoreLines(mut self) : bool

Whether another byte is available before EOF, without consuming it.

Returns true while the stream has at least one more byte

#readLine

readLine(mut self) : string ! IOException

Read one line (up to but excluding '\n'); "" at EOF. A '\r'
immediately followed by '\n' is a CRLF terminator and is dropped;
a lone '\r' is line content, as is a '\r' that ends the file.

Returns the line content without its terminator, or "" at EOF
Throws
IOException never — carried because hasMoreLines and this
share a refill that cannot distinguish a read error from EOF,
so a failed read answers "" rather than throwing.

#close

close(mut self) : void ! IOException

Close the handle; idempotent once closed.

C class BufferedWriter

Text writer over a FileOutputStream. The usual pattern is
new BufferedWriter(new FileOutputStream(path, FileOpenMode::WRITE));
the writer steals the source stream's handle, leaving the source inert.

Constructors

TypeMethod and description
constructor(output : FileOutputStream) Take ownership of output's open handle. output is left inert
and must not be used afterwards.

Method detail

#constructor

constructor(output : FileOutputStream)

Take ownership of output's open handle. output is left inert
and must not be used afterwards.

Parameters
output source stream whose open handle is taken over

Methods

TypeMethod and description
void
write(self, content : string) : void Write content verbatim, with no trailing newline.
void
writeLine(self, content : string) : void Write content followed by a '\n'.
void
flush(self) : void Flush libc's buffer to disk.
void
close(mut self) : void Flush then close the handle; idempotent once closed.

Method detail

#write

write(self, content : string) : void ! IOException

Write content verbatim, with no trailing newline.

Parameters
content text written verbatim to the stream
Throws
IOException if the stream is closed.

#writeLine

writeLine(self, content : string) : void ! IOException

Write content followed by a '\n'.

Parameters
content text written before the appended newline
Throws
IOException if the stream is closed.

#flush

flush(self) : void ! IOException

Flush libc's buffer to disk.

#close

close(mut self) : void ! IOException

Flush then close the handle; idempotent once closed.

C class PrintWriter

Print-style text writer over a FileOutputStream — the file-output
sibling of Console. Constructed like BufferedWriter, stealing the
source stream's handle.

Constructors

TypeMethod and description
constructor(output : FileOutputStream) Take ownership of output's open handle. output is left inert
and must not be used afterwards.

Method detail

#constructor

constructor(output : FileOutputStream)

Take ownership of output's open handle. output is left inert
and must not be used afterwards.

Parameters
output source stream whose open handle is taken over

Methods

TypeMethod and description
void
print(self, text : string) : void Write text verbatim, with no trailing newline.
void
println(self, text : string) : void Write text followed by a '\n'.
void
printf(self, format : string) : void No varargs: writes the format string verbatim (the file-output
sibling of Console::print).
void
flush(self) : void Flush libc's buffer to disk without closing.
void
close(mut self) : void Flush then close the handle; idempotent once closed.

Method detail

#print

print(self, text : string) : void ! IOException

Write text verbatim, with no trailing newline.

Parameters
text text written verbatim to the stream
Throws
IOException if the stream is closed.

#println

println(self, text : string) : void ! IOException

Write text followed by a '\n'.

Parameters
text text written before the appended newline
Throws
IOException if the stream is closed.

#printf

printf(self, format : string) : void ! IOException

No varargs: writes the format string verbatim (the file-output
sibling of Console::print).

Parameters
format format string written verbatim; no substitution
Throws
IOException if the stream is closed.

#flush

flush(self) : void ! IOException

Flush libc's buffer to disk without closing.

#close

close(mut self) : void ! IOException

Flush then close the handle; idempotent once closed.

C class Scanner

Conventional stdin reader over the libc stdin FILE*. One Scanner
per program is the usual shape; the default ctor binds to the
process stdin handle. A one-byte pushback slot (peeked) lets
hasNextLine look ahead for EOF without consuming the byte the next
read must return.

Constructors

TypeMethod and description
constructor() Bind to the process-wide stdin handle with an empty pushback.

Method detail

#constructor

constructor()

Bind to the process-wide stdin handle with an empty pushback.

Methods

TypeMethod and description
string
nextLine(mut self) : string Read the next line (excluding the terminator); "" at EOF. A
trailing CR is dropped so a CRLF terminator chomps cleanly.
bool
hasNextLine(mut self) : bool Whether another line is available before EOF. Peeks one byte into
the pushback slot so the following read still returns it.
i32
nextI32(mut self) : i32 Read the next line and parse it as a base-10 i32.
i64
nextI64(mut self) : i64 Read the next line and parse it as a base-10 i64.
f64
nextF64(mut self) : f64 Read the next line and parse it as an IEEE-754 f64.
void
close(mut self) : void Release the scanner. The process-wide stdin handle is shared, so
close() does not fclose it; it only marks this Scanner inert.

Method detail

#nextLine

nextLine(mut self) : string ! IOException

Read the next line (excluding the terminator); "" at EOF. A
trailing CR is dropped so a CRLF terminator chomps cleanly.

Returns the line content without its terminator, or "" at EOF
Throws
IOException if the scanner has been closed.

#hasNextLine

hasNextLine(mut self) : bool

Whether another line is available before EOF. Peeks one byte into
the pushback slot so the following read still returns it.

#nextI32

nextI32(mut self) : i32 ! IOException, ParseException

Read the next line and parse it as a base-10 i32.

Throws
IOException if input is exhausted before a line is read.
ParseException if the line is not a valid integer.

#nextI64

nextI64(mut self) : i64 ! IOException, ParseException

Read the next line and parse it as a base-10 i64.

Throws
IOException if input is exhausted before a line is read.
ParseException if the line is not a valid integer.

#nextF64

nextF64(mut self) : f64 ! IOException, ParseException

Read the next line and parse it as an IEEE-754 f64.

Throws
IOException if input is exhausted before a line is read.
ParseException if the line is not a valid number.

#close

close(mut self) : void ! IOException

Release the scanner. The process-wide stdin handle is shared, so
close() does not fclose it; it only marks this Scanner inert.

T trait InputStream

Byte-oriented readable stream. Extends Closeable so a
try-with-resources pattern closes the stream on exit.

read() returns the next byte as 0..255, or -1 at EOF; the i32
return type is intentional — a signed i8 cannot distinguish -1
(EOF) from byte 0xFF. readBytes bulk-reads into a caller-supplied
i8[] slice [offset, offset+len), returning the count read or -1 at
EOF. skip advances the position by up to n bytes. available is a
non-blocking lower bound on bytes readable without blocking.

TypeMethod and description
i32
read(self) : i32 Next byte 0..255, or -1 at EOF.
i64
readBytes(self, mut buf : i8[], offset : i64, len : i64) : i64 Read up to len bytes into buf[offset .. offset+len).
i64
skip(self, n : i64) : i64 Skip up to n bytes forward in the stream.
i64
available(self) : i64 Lower bound on bytes readable without blocking.
Returns 0 when the stream is closed or at EOF.
void
close(self) : void Release the stream. Idempotent. Redeclared from Closeable so a
polymorphic stream.close() dispatches against InputStream's
own contract row.

Method detail

#read

read(self) : i32 ! IOException

Next byte 0..255, or -1 at EOF.

#readBytes

readBytes(self, mut buf : i8[], offset : i64, len : i64) : i64 ! IOException

Read up to len bytes into buf[offset .. offset+len).

Parameters
buf destination buffer
offset first destination index
len maximum bytes to read
Returns bytes read, or -1 at EOF

#skip

skip(self, n : i64) : i64 ! IOException

Skip up to n bytes forward in the stream.

Parameters
n maximum bytes to skip
Returns bytes actually skipped

#available

available(self) : i64

Lower bound on bytes readable without blocking.
Returns 0 when the stream is closed or at EOF.

#close

close(self) : void ! IOException

Release the stream. Idempotent. Redeclared from Closeable so a
polymorphic stream.close() dispatches against InputStream's
own contract row.

T trait OutputStream

Byte-oriented writable stream. Extends Closeable so a
try-with-resources pattern closes the stream on exit.

write(b) emits the low 8 bits of b. writeBytes bulk-writes from
a caller-supplied i8[] slice [offset, offset+len). flush pushes
any libc or in-memory buffer to the underlying sink.

TypeMethod and description
void
write(self, b : i32) : void Write the low 8 bits of b as one byte.
void
writeBytes(self, buf : i8[], offset : i64, len : i64) : void Write buf[offset .. offset+len) to the stream.
void
flush(self) : void Flush any buffered bytes to the underlying sink.
void
close(self) : void Release the stream. Idempotent. Redeclared from Closeable so a
polymorphic stream.close() dispatches against OutputStream's
own contract row.

Method detail

#write

write(self, b : i32) : void ! IOException

Write the low 8 bits of b as one byte.

Parameters
b source value; only its low 8 bits are emitted

#writeBytes

writeBytes(self, buf : i8[], offset : i64, len : i64) : void ! IOException

Write buf[offset .. offset+len) to the stream.

Parameters
buf source buffer
offset first source index
len number of bytes to write

#flush

flush(self) : void ! IOException

Flush any buffered bytes to the underlying sink.

#close

close(self) : void ! IOException

Release the stream. Idempotent. Redeclared from Closeable so a
polymorphic stream.close() dispatches against OutputStream's
own contract row.