deserialize data from a serialized data stream More...
Public Member Functions | |
number | deserialize_1 () |
deserialize 1 signed byte More... | |
number | deserialize_1u () |
deserialize 1 unsigned byte More... | |
number | deserialize_2 () |
deserialize 2 signed bytes More... | |
number | deserialize_2u () |
deserialize 2 unsigned bytes More... | |
number | deserialize_3u () |
deserialize 3 unsigned bytes More... | |
number | deserialize_4 () |
deserialize 4 signed bytes More... | |
number | deserialize_4u () |
deserialize 4 unsigned bytes More... | |
number | deserialize_8 () |
deserialize 8 signed bytes More... | |
number | deserialize_8u () |
deserialize 8 unsigned bytes More... | |
boolean | deserialize_bool () |
deserialize a 1 bit boolean value More... | |
Color | deserialize_color () |
deserialize a Color More... | |
number | deserialize_d () |
deserialize a double precision floating point value More... | |
number | deserialize_f () |
deserialize a single precision floating point value More... | |
MemBlock | deserialize_mem () |
deserialize arbitrary binary data More... | |
number | deserialize_memGetLen () |
get size of mem block that is next in the stream More... | |
ISerializable | deserialize_obj () |
deserialize an object More... | |
Offset | deserialize_offset () |
deserialize an Offset More... | |
Point | deserialize_point () |
deserialize a Point More... | |
Quad | deserialize_quad () |
deserialize a Quad More... | |
Rect | deserialize_rect () |
deserialize a Rect More... | |
object | deserialize_ref () |
RotatedRect | deserialize_rotr () |
deserialize a RotatedRect More... | |
string | deserialize_str () |
deserialize an arbitrary string More... | |
number | deserialize_uint () |
deserialize an unsigned number More... | |
Vector | deserialize_vector () |
deserialize a Vector More... | |
setDataPtr (BinaryString data) | |
set the serialized data More... | |
setDataPtr (MemBlock data) | |
set the serialized data More... | |
deserialize data from a serialized data stream
Deserializer retrieves and reconstructs complex data from a serialized data stream in memory. The stream must have been created by a Serializer. It will correctly rebuild entire object hierarchies, creating new objects of the correct classes without duplication as needed. In order to deserialize objects, you must register them using pdg.registerSerializableClass. Built in serializable objects, such as Sprites and SpriteLayers are pre-registered.
The data stream format written by Serializer is platform neutral, so it can be decoded on a different platform (or even language) than it was created with. Thus it is suitable for saved game files and network messages between client and server.
Deserializer looks for tags written by Serializer at key points in the stream to verify things haven't gotten out of sync. However, if you want your serialized data streams to be versioned, you will have to add that yourself; either on a per object/message basis or for an entire saved stream.
deserialize_1 | ( | ) |
deserialize 1 signed byte
Read a one byte signed value from the data stream.
deserialize_1u | ( | ) |
deserialize 1 unsigned byte
Read an unsigned one byte value from the data stream.
deserialize_2 | ( | ) |
deserialize 2 signed bytes
Read a signed two byte value from the data stream.
deserialize_2u | ( | ) |
deserialize 2 unsigned bytes
Read an unsigned two byte value from the data stream.
deserialize_3u | ( | ) |
deserialize 3 unsigned bytes
Read an unsigned three byte value from the data stream.
deserialize_4 | ( | ) |
deserialize 4 signed bytes
Read a signed four byte value from the data stream.
deserialize_4u | ( | ) |
deserialize 4 unsigned bytes
Read an unsigned four byte value from the data stream.
deserialize_8 | ( | ) |
deserialize 8 signed bytes
Read a signed eight byte value from the data stream.
deserialize_8u | ( | ) |
deserialize 8 unsigned bytes
Read an unsigned eight byte value from the data stream.
deserialize_bool | ( | ) |
deserialize a 1 bit boolean value
Read an one bit boolean (true/false) value from the data stream.
deserialize_color | ( | ) |
deserialize a Color
Read a Color value from the data stream.
deserialize_d | ( | ) |
deserialize a double precision floating point value
Read an eight byte double precision floating point value from the data stream.
deserialize_f | ( | ) |
deserialize a single precision floating point value
Read a four byte single precision floating point value from the data stream.
deserialize_mem | ( | ) |
deserialize arbitrary binary data
Read a chunk of arbitrary binary data from the stream into a MemBlock. The amount of data that will be read can be discovered by calling deserialize_memGetLen() before you call deserialize_mem(). If you want to get the size afterwards, you must call MemBlock.getDataSize() on the data returned
deserialize_memGetLen | ( | ) |
get size of mem block that is next in the stream
Reports the size of the MemBlock that will be created by an immediate call to deserialize_mem(). If you want to get the size after you've made the deserialize_mem() call, use MemBlock.getDataSize()
deserialize_obj | ( | ) |
deserialize an object
This deserializes a object and all its data into the stream. It does this by instantiating a new object of the correct type, then calling that object's deserialize method. The object's deserialize() in turn calls deserialize methods for each of the object's data members. If the given object's data members include other ISerializable objects, then deserialize_obj() is called recursively to deserialize those objects.
The Deserializer keeps track of what objects have already been deserialized from the stream. So if deserialize_obj() is called for an object that has already been deserialized, it just returns a reference to the existing object rather than creating a duplicate object
deserialize_offset | ( | ) |
deserialize an Offset
Read an Offset's x and y values value from the data stream.
deserialize_point | ( | ) |
deserialize a Point
Read a Point value from the data stream.
deserialize_quad | ( | ) |
deserialize a Quad
Read a Quad (4 point) value from the data stream.
deserialize_rect | ( | ) |
deserialize a Rect
Read a Rect value from the data stream.
object deserialize_ref | ( | ) |
deserialize_rotr | ( | ) |
deserialize a RotatedRect
Read a RotatedRect value from the data stream.
deserialize_str | ( | ) |
deserialize an arbitrary string
Read an arbitrary string from the stream.
deserialize_uint | ( | ) |
deserialize an unsigned number
Read an unsigned value from the data stream.
deserialize_vector | ( | ) |
deserialize a Vector
Read a Vector value from the data stream.
setDataPtr | ( | BinaryString | data | ) |
set the serialized data
Set the data block that should be deserialized. It should have been created at some point by a pdg.Serializer.
data | the BinaryString object with the serialized data |
setDataPtr | ( | MemBlock | data | ) |
set the serialized data
Set the data block that should be deserialized. It should have been created at some point by a pdg.Serializer.
data | the MemBlock object with the serialized data |