Skip to content

Reader

class Reader < Object

Abstract reader.

Typical use is to use the Reader factory function to instantiate an object of an appropriate derived class based on the file extension of the given path:

auto reader <- Reader(path);

A reader of a single buffer can then be performed with:

reader.read(buffer);

Finally, close the file:

reader.close();

Factory Functions

Name Description
Reader Create a reader for a file.

Member Functions

Name Description
open Open a file.
read Read the entire contents of the file.
close Close the file.

Factory Function Details

function Reader(path:String) -> Reader

Create a reader for a file.

  • path: Path of the file.

Returns: the reader.

The file extension of path is used to determine the precise type of the returned object. Supported file extension are .json and .yml.

Member Function Details

close

function close()

Close the file.

open

function open(path:String)

Open a file.

  • path : Path of the file.

read

function read(buffer:MemoryBuffer)

Read the entire contents of the file.

  • buffer: Buffer into which to read.