FixIO Documentation
Back to summary
import "io/file";
File class
Opened file.
Inherits from Stream.
Initialization
static function create(): File
-
Creates a new instance of file interface, intended for subclassing only.
static function open(path: Path or String, mode: Integer): File
-
Opens a file with given mode. The mode is consisting of these flags:
FILE_READ - open the file for reading
FILE_WRITE - open the file for writing
FILE_CREATE - create (if it doesn't exist) or truncate (when it exists)
Common functions
static function read_whole(path: Path or String): Byte[]
static function read_whole(path: Path or String, buf: Byte[]): Byte[]
-
Reads the whole file into provided buffer (or a created one).
static function write_whole(path: Path or String, buf: Byte[])
static function write_whole(path: Path or String, buf: Byte[], off: Integer, len: Integer)
-
Writes the whole buffer (or portion) to the file.
File interface
virtual function get_length(): Long
-
Returns the length of the file.
virtual function get_position(): Long
-
Returns the current position in the file.
virtual function set_position(pos: Long)
-
Sets the current position in the file.
Functions
function seek_rel(offset: Integer)
-
Sets the current position relative to current position.
function seek_set(offset: Integer)
-
Sets the current position relative to beginning.
function seek_end(offset: Integer)
-
Sets the current position relative to end.