Class Models for Lua

File Stream
loop.serial.FileStream
Subclass of Serializer
that serializes values into a file. It is also used to restore values serialized in a file using the serialization mechanism provided by Serializer
. This class is useful to implement persitence mechanisms.
Instances of this class implement the write
method required by Serializer
in such way that the pieces of the serialized code are written directly into the file.
Behavior
Fields
buffersize
- Maximum number of characters read from the file at each read access to the file. By default, this field is 1024.
file
[required]- Handler of the file where the serialied code shall be written. This handler is also used to read the serialized code used to restore values. In this case, the file may contain sequences of serialized values separated by a null character followed by a newline character (i.e.
"\0\n"
).
Methods
put(...)
- Serializes the arguments and stores the results in the file defined by field
file
. The sequences of values serialized by this function are terminated by a null character followed by a newline character (i.e."\0\n"
). get()
- Each time this method is called, it restores one of the set of values serialized in the file defined by field
file
, in the same order they were serialized. All the set of values stored in the file defined by fieldfile
must be separated by a null character followed by a newline character (i.e."\0\n"
).
Remarks
- Methods
serialize
andload
of the superclassSerializer
should not be used because they break the serialization policy used by this class.
Examples
$ExampleDescription
-- example missing
Copyright (C) 2004-2008 Tecgraf, PUC-RioThis project is currently being maintained by Tecgraf at PUC-Rio.