v2026.5.3
All Bundles
Bundle Supports filesystem operations

FileReader

Supports file read operations

Inherits: File
reader := System.IO.FileReader->New("data.txt");
while(reader->IsEOF() <> true) {
  line := reader->ReadLine();
  line->PrintLine();
};
reader->Close();

Operations

Close #

Closes the file

method : public : Close() ~ Nil

Example

reader := System.IO.FileReader->New("file.txt");
# ... read operations ...
reader->Close();

New # constructor

Default constructor.

New(name:System.String)

Parameters

NameTypeDescription
nameStringfilename

ReadBinaryFile # function

Reads a file's contents into byte array

function : ReadBinaryFile(name:String) ~ Byte[]

Parameters

NameTypeDescription
nameStringfilename

Return

TypeDescription
Bytebyte array, Nil if file is not found

ReadBuffer #

Reads bytes into a character buffer

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

Parameters

NameTypeDescription
offsetIntdestination buffer offset
numIntnumber of values to read
bufferCharinput buffer

Return

TypeDescription
Intnumber of values read

ReadBuffer #

Reads bytes into a byte buffer

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

Parameters

NameTypeDescription
offsetIntdestination buffer offset
numIntnumber of values to read
bufferByteinput buffer

Return

TypeDescription
Intnumber of values read

ReadByte #

Reads a byte

method : public : ReadByte() ~ Byte

Return

TypeDescription
Bytebyte read

Example

reader := System.IO.FileReader->New("data.bin");
b := reader->ReadByte();
b->PrintLine();
reader->Close();

ReadFile # function

Reads a file's contents into a string

function : ReadFile(name:String) ~ String

Parameters

NameTypeDescription
nameStringfilename

Return

TypeDescription
Stringcharacter string, Nil if file is not found

Example

content := System.IO.FileReader->ReadFile("readme.txt");
if(content <> Nil) {
  content->PrintLine();
};

ReadLine #

Reads a string until a newline or character return is detected

method : public : ReadLine() ~ System.String

Return

TypeDescription
Stringcharacter string

Example

reader := System.IO.FileReader->New("log.txt");
line := reader->ReadLine();
while(line <> Nil) {
  line->PrintLine();
  line := reader->ReadLine();
};
reader->Close();