Class Models for Lua

String Stream
loop.serial.StringStream
Subclass of Serializer
that serializes values into a string. It is also used to restore values serialized in a string using the serialization mechanism provided by Serializer
. This class is useful to pack values into strings that can be stored in run-time memory or other sort of storage.
Instances of this class implement the write
method required by Serializer
in such way that it stores the pieces of the serialized code in the instance itself and concatenates them to produce the serialized code.
Behavior
Fields
data
[optional]- String containing sequences of serialized values separated by null characters (i.e.
"\0"
). This string must contain the serialized code of the values to be restored. If this field evaluates tofalse
then the serialized code produced previously by the instance is used to retrieve values.
Methods
put(...)
- Serializes the arguments and stores the results in the instance so it is used to form the complete final serialized code in a string. The sequences of values serialized by this function are separated by null characters (i.e.
"\0"
). get()
- Each time this method is called, it restores one of the set of values serialized in the string stored in field
data
, in the same order they were serialized. All the set of values stored in the string stored in fielddata
must be separated by null characters (i.e."\0"
).
Meta-Fields
__tostring
- Concatenates all the pieces of serialized code to form a string containing all serialized values. If there are more than one sequence of values serialized then such sequences are separated by null characters (i.e.
"\0"
).
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.