io
Generated by tinox doc
IO utilities: a mutable string Buffer for incremental building, File for basic file handles, Paths for filename/extension/directory manipulation, and Io's console helpers (printLine, printHeader).
Buffer and paths
import tinox.core.io;
class Main
{
fnc main() -> Int32
{
let buf: Buffer = Buffer::new();
buf.appendLine("first line");
buf.append("second");
println(buf.toString());
Io::printHeader("Paths");
println(Paths::getExtension("archive.tar.gz"));
println(Paths::getFileName("/var/log/app.log"));
println(Paths::join("/var/log", "app.log"));
return 0;
}
}
class Buffer
* A mutable string buffer for efficient string concatenation
*
* Useful for building up strings incrementally without
* creating intermediate string objects.
Fields
data | String | The accumulated string data |
Methods
fn new() → Buffer
* Creates a new empty Buffer
*
* @return a new Buffer instance
fn append(s: String) → Nothing
* Appends a string to the buffer
*
* @param s the string to append
fn appendInt(n: Int64) → Nothing
* Appends the string representation of an integer
*
* @param n the integer to append
fn appendLine(s: String) → Nothing
* Appends a string followed by a newline
*
* @param s the string to append
fn clear() → Nothing
* Clears all content from the buffer
fn toString() → String
* Returns the accumulated string
*
* @return the buffer contents as a string
fn isEmpty() → Bool
* Checks if the buffer is empty
*
* @return true if no content has been appended
class File
* Represents a file handle for reading and writing
*
* Provides methods for opening, reading, writing, and closing files.
* Uses the underlying runtime file operations.
Fields
path | String | The file path |
handle | Int64 | The file handle (0 if not open) |
Methods
fn new(path: String) → File
* Creates a new File instance (not yet opened)
*
* @param path the file path
* @return a new File instance
fn getPath() → String
* Returns the file path
*
* @return the path string
fn close() → Nothing
* Closes the file if it is open
fn exists(path: String) → Bool
* Checks if a file exists at the given path
*
* @param path the file path to check
* @return true if the file exists
class Io
* IO utility class providing console output helpers
* and factory methods for creating IO objects
Methods
fn newBuffer() → Buffer
* Creates a new empty Buffer
*
* @return a new Buffer instance
fn printLine(value: String) → Nothing
* Prints a string followed by a newline
*
* @param value the string to print
fn printHeader(title: String) → Nothing
* Prints a formatted header with separator lines
*
* @param title the header text to display
class Paths
* Path manipulation utilities for working with file paths
Methods
fn getExtension(filename: String) → String
* Extracts the file extension from a filename
*
* @param filename the filename (e.g., "file.txt")
* @return the extension without the dot (e.g., "txt"), or empty string
fn getFileName(filePath: String) → String
* Extracts the filename from a full path
*
* @param filePath the full path (e.g., "/path/to/file.txt")
* @return the filename portion (e.g., "file.txt")
fn getDirectory(filePath: String) → String
* Extracts the directory portion from a full path
*
* @param filePath the full path (e.g., "/path/to/file.txt")
* @return the directory portion (e.g., "/path/to"), or empty string
fn join(dir: String, file: String) → String
* Joins a directory and filename with a path separator
*
* @param dir the directory path
* @param file the filename
* @return the combined path (e.g., "dir/file")