io
import ioFunctions
Section titled “Functions”| Function | Signature | Description |
|---|---|---|
read_line | () -> String | Read a single line from standard input |
print | (String) -> Unit | Print a string to stdout without a trailing newline |
read_all | () -> String | Read all of standard input as a single string |
write_bytes | (List[Int]) -> Unit | Write raw bytes to stdout (no UTF-8 conversion) |
write | (Bytes) -> Unit | Write a Bytes buffer to stdout (zero-copy, buffered) |
Reference
Section titled “Reference”io.read_line() -> String
Section titled “io.read_line() -> String”Read a single line from standard input
let name = io.read_line()io.print(s: String) -> Unit
Section titled “io.print(s: String) -> Unit”Print a string to stdout without a trailing newline
io.print("Enter name: ")io.read_all() -> String
Section titled “io.read_all() -> String”Read all of standard input as a single string
let input = io.read_all()io.write_bytes(data: List[Int]) -> Unit
Section titled “io.write_bytes(data: List[Int]) -> Unit”Write raw bytes to stdout (no UTF-8 conversion)
io.write_bytes([0x50, 0x34, 0x0A])io.write(data: Bytes) -> Unit
Section titled “io.write(data: Bytes) -> Unit”Write a Bytes buffer to stdout (zero-copy, buffered)
io.write(buf)io.read_byte() -> Int
Section titled “io.read_byte() -> Int”Read a single byte from stdin (returns -1 on EOF).
let b = io.read_byte()io.read_n_bytes(n: Int) -> List[Int]
Section titled “io.read_n_bytes(n: Int) -> List[Int]”Read N bytes from stdin (may return fewer on EOF).
let data = io.read_n_bytes(4)