module ValueIO
rascal-0.40.16
Library functions for reading and writing values in textual and binary format.
Usage
import ValueIO;
Dependencies
import Type;
function readValueFile
Read a value from a binary file in PBF format.
value readValueFile(loc file)
function getFileLength
Get length of a file in number of bytes.
int getFileLength(loc file)
function readBinaryValueFile
Read a typed value from a binary file.
&T readBinaryValueFile(type[&T] result, loc file)
value readBinaryValueFile(loc file)
function readTextValueFile
Read a typed value from a text file.
&T readTextValueFile(type[&T] result, loc file)
value readTextValueFile(loc file)
function readTextValueFileWithEmbeddedTypes
If you have written a file containing reified types, then you can use this function to read them back.
&T readTextValueFileWithEmbeddedTypes(type[&T] result, loc file)
function readTextValueString
Parse a textual string representation of a value.
value readTextValueString(str input)
function readTextValueString
Parse a textual string representation of a value and validate it against the given type.
&T readTextValueString(type[&T] result, str input)
function writeBinaryValueFile
Write a value to a file using an efficient binary file format.
void writeBinaryValueFile(loc file, value val, bool compression = true)
function writeTextValueFile
Write a value to a file using a textual file format.
void writeTextValueFile(loc file, value val)