abstract class Writer < Object
Typical use is to use the
Writer factory function to instantiate an
object of an appropriate derived class based on the file extension of the
auto writer <- Writer(path);
A write of a single buffer can then be performed with:
A write of a sequence of buffers can be performed with:
writer.startSequence(); writer.write(buffer1); writer.write(buffer2); writer.write(buffer3); writer.endSequence();
which is useful for not keeping the entire contents of the file, to be written, in memory.
Finally, close the file:
A file may not be valid until the writer is closed, depending on the file format.
|Writer||Create a writer for a file.|
|open||Open a file.|
|write||Write the entire contents of the file.|
|flush||Flush accumulated writes to the file.|
|close||Close the file.|
|startMapping||Start a mapping.|
|endMapping||End a mapping.|
|startSequence||Start a sequence.|
|endSequence||End a sequence.|
Factory Function Details
Create a writer for a file.
- path: Path of the file.
Returns: the writer.
The file extension of
path is used to determine the precise type of the
returned object. Supported file extension are
Member Function Details
abstract function close()
Close the file.
abstract function endMapping()
End a mapping.
abstract function endSequence()
End a sequence.
abstract function flush()
Flush accumulated writes to the file.
abstract function open(path:String)
Open a file.
- path : Path of the file.
abstract function startMapping()
Start a mapping.
abstract function startSequence()
Start a sequence.
abstract function write(buffer:MemoryBuffer)
Write the entire contents of the file.
- buffer: Buffer to write.