v2026.5.3
All Bundles
Bundle Supports filesystem operations

FileWriter

Supports file write operations

Inherits: File
writer := System.IO.FileWriter->New("output.txt");
writer->WriteString("Hello, World!\n");
writer->Close();

Operations

Close #

Closes a file

method : public : Close() ~ Nil

Example

writer := System.IO.FileWriter->New("file.txt");
writer->WriteString("done");
writer->Close();

New # constructor

Opens a new file.

New(name:System.String)

Parameters

NameTypeDescription
nameStringfilename

New # constructor

Opens a new file or appends to an existing one.

New(name:System.String, append:Bool)

Parameters

NameTypeDescription
nameStringfilename
appendBoolif true, opens a file for appending otherwise creates a new file

Temp # function

Creates a temporary file

function : Temp() ~ FileWriter

WriteBuffer #

Writes bytes from a buffer

method : public : WriteBuffer(buffer:Byte[]) ~ Int

Parameters

NameTypeDescription
bufferByteoutput buffer

Return

TypeDescription
Inttrue if successful, false otherwise

WriteBuffer #

Writes bytes from a buffer

method : public : WriteBuffer(offset:Int, num:Int, buffer:Byte[]) ~ Int

Parameters

NameTypeDescription
offsetIntdestination buffer offset
numIntnumber of values to write
bufferByteoutput buffer

Return

TypeDescription
Intnumber of values written

WriteBuffer #

Writes characters from a buffer

method : public : WriteBuffer(buffer:Char[]) ~ Int

Parameters

NameTypeDescription
bufferCharoutput buffer

Return

TypeDescription
Inttrue if successful, false otherwise

WriteBuffer #

Writes characters from a buffer

method : public : WriteBuffer(offset:Int, num:Int, buffer:Char[]) ~ Int

Parameters

NameTypeDescription
offsetIntdestination buffer offset
numIntnumber of values to write
bufferCharinput buffer

Return

TypeDescription
Intnumber of values written

WriteByte #

Writes a byte

method : public : WriteByte(b:Int) ~ Bool

Parameters

NameTypeDescription
bIntbyte to write

Return

TypeDescription
Booltrue if byte was written, false otherwise

Example

writer := System.IO.FileWriter->New("out.bin");
writer->WriteByte(65);  # 'A'
writer->Close();

WriteFile # function

Write string to file

function : WriteFile(name:String, content:String) ~ Bool

Parameters

NameTypeDescription
nameStringfilename
contentStringstring to write

Return

TypeDescription
Booltrue if successful, false otherwise

Example

System.IO.FileWriter->WriteFile("output.txt", "Hello, World!");

WriteFile # function

Write bytes to file

function : WriteFile(name:String, content:Byte[]) ~ Bool

Parameters

NameTypeDescription
nameStringfilename
contentByteto write

Return

TypeDescription
Booltrue if successful, false otherwise

Example

data := Byte[]{72, 101, 108, 108, 111};
System.IO.FileWriter->WriteFile("bytes.bin", data);

WriteString #

Writes a character string

method : public : WriteString(str:System.String) ~ Nil

Parameters

NameTypeDescription
strStringstring to be written

Example

writer := System.IO.FileWriter->New("log.txt");
writer->WriteString("Event logged\n");
writer->Close();