fscom.serialization: | Functions | Types | Modinfo | Source |
This implementation of Serialization writes the byte array directly to a stream. Deserialization reads the byte array from a given stream.
ReadBBString | Read a BlitzBasic style String from a stream: An integer for the length followed by the actual string. |
StreamDeserializeObject | Deserialize an object from a stream. |
StreamSerializeObject | Serialize an object into a stream. |
WriteBBString | Write a BlitzBasic style String to a stream: An integer for the length followed by the actual string. |
TObjectFactory | ObjectFactory base type. |
Function ReadBBString:String(stream:TStream) | |
Description | Read a BlitzBasic style String from a stream: An integer for the length followed by the actual string. |
Function StreamDeserializeObject:Object(stream:TStream, knownObjectTree:TKnownObjectTree=Null) | |
Description | Deserialize an object from a stream. |
Function StreamSerializeObject(obj:Object , stream:TStream, knownObjectTree:TKnownObjectTree=Null) | |
Description | Serialize an object into a stream. |
Function WriteBBString(stream:TStream,str:String) | |
Description | Write a BlitzBasic style String to a stream: An integer for the length followed by the actual string. |
Type TObjectFactory | |
Description | ObjectFactory base type. |
Information | Extend this type to write serialization/deserialization methods for your custom objects. Then create an object of your type. SerializeObject and DeserializeObject will try the newest factory first, then go for older ones ending in a generic object factory that will try to serialize your object by information from the reflection module. |
Methods Summary | |
---|---|
Deserialize | Try to deserialize an object. |
Serialize | Try to serialize an object. |
Method Deserialize:Object(typeId:TTypeId, stream:TStream, knownObjectTree:TKnownObjectTree) Abstract | |
Returns | The deserialized object or Null if it's not a siutable serializer. |
Description | Try to deserialize an object. |
Information | Deserialize will inspect typeId to determine if it is able to deserialize this kind of object. If so, it will read the data from the stream and build an object. It will not touch the stream to inspect the object and then decide to not to deserialize it. It can of course try to deserialize it and throw an error if the object was not serialized as expected. Use knownObjectTree to resolve cyclic structures by searching for a stored id in the known objects and only deserialize an object if the is not found. Else just use the object returned by the known object tree. |
Method Serialize:Byte(obj:Object , typeId:TTypeId , stream:TStream, knownObjectTree:TKnownObjectTree) Abstract | |
Returns | True if successfully serialized an object. False if it's not a siutable serializer. |
Description | Try to serialize an object. |
Information | Serialize will inspect typeId and obj to determine if it is able to serialize the object. If so, it will write the neccesary data into the stream. It will not touch the stream if it doesn't actually want to serialize the object. If an error occours an error should be thrown. Use knownObjectTree to resolve cyclic structures by searching for obj in the known objects and only serialize it if it is not found. In both cases insert the id returned by the methods of the known object tree. |
Version | 1.2 |
---|---|
Author | Francesco Silvani |
License | zlib/libpng |
History | 1.2 |
History | Fixed behaviour for empty Arrays (Null[]) |
History | Switched from TTypeId.Fields to TTypeId.EnumFields to cover extended types |