io

FileMode

enum FileMode {
    read,
    write,
    update,
}

File mode with which you can open a file

File

object File

Object to manipulate an opened file

file

file: ud

File descriptor

open

static fun open(filename: str, mode: FileMode) > mut File !> FileSystemError, UnexpectedError

Open file

  • filename: Path of file to open
  • mode: Mode with which to open it Returns: opened file

collect

fun collect() > void

Close file when it is collected.

close

fun close() > void

Close file

readAll

fun readAll(maxSize: int?) > str !> ReadWriteError, FileSystemError, UnexpectedError

Reads file until EOFReturns: Read data

readLine

fun readLine(maxSize: int?) > str? !> ReadWriteError, FileSystemError, UnexpectedError

Reads next line, returns null if nothing to read Returns: Read data

read

fun read(n: int) > str? !> ReadWriteError, FileSystemError, InvalidArgumentError, UnexpectedError

Reads n bytes, returns null if nothing to read

  • n: how many bytes to read Returns: Read data

write

fun write(bytes: str) > void !> FileSystemError, ReadWriteError, UnexpectedError

Write bytes

  • bytes: string to write

isTTY

fun isTTY() > bool

Returns: true if file is TTY

getPoller

fun getPoller() > mut FilePoller

Returns: FilePoller that can be used to poll incoming data on that file

FilePoller

object FilePoller

Object used to poll incoming data on a file.

poller

poller: ud

Underlying zig poller

poll

fun poll(timeout: int?) > str? !> FileSystemError, UnexpectedError

Poll file, blocking for at most timeout before returning.

  • timeout: Maximum time to block, or null to block indefinitely Returns: The string read if any, null otherwise

collect

fun collect() > void

Deinitialize poller when it is collected.

deinit

fun deinit() > void

Frees the poller.

stdin

final stdin: mut File

stdin

stdout

final stdout: mut File

stdout

stderr

final stderr: mut File

stderr

runFile

fun runFile(filename: str) > void !> CompileError, InterpretError, FileSystemError, ReadWriteError, UnexpectedError

Run a buzz file

  • filename: path to buzz file
Last Updated:
Contributors: Benoit Giannangeli