Try OpenEdge Now
skip to main content
ABL Reference
Class Properties and Methods Reference : Deserialize( ) method (BinarySerializer)
 

Deserialize( ) method (BinarySerializer)

Deserializes an ABL class-based object from the specified binary stream.
Return type: Progress.Lang.Object class
Access: PUBLIC
Applies to: Progress.IO.BinarySerializer class

Syntax

Deserialize( INPUT input-stream AS Progress.IO.InputStream )
input-stream
The stream from which the class-based object is deserialized.
The following code sample serializes and deserializes myObj:
DEFINE VARIABLE myFileOutStream AS Progress.IO.FileOutputStream.
DEFINE VARIABLE myFileInStream AS Progress.IO.FileInputStream.
DEFINE VARIABLE mySerializer AS Progress.IO.BinarySerializer.
DEFINE VARIABLE myObj AS Acme.MyClass.

myObj = NEW Acme.MyClass().

mySerializer = NEW Progress.IO.BinarySerializer().

/* Serialize object */
myFileOutStream = NEW Progress.IO.FileOutputStream("MyClass.bin").
mySerializer:Serialize(myObj, myFileOutStream).
myFileOutStream:Close().

/* Deserialize object */
myFileInStream = NEW Progress.IO.FileInputStream("MyClass.bin").
myObj = CAST(mySerializer:Deserialize(myFileInStream), Acme.MyClass).
myFileInStream:Close().

Notes

*If a class member is not present in the input stream, then that member will be assigned the default value for its type.
*If the input stream is unknown or cannot be read from, the AVM raises an error.
*If the class of the object being deserialized changed between serialization and deserialization in a way that causes the object and its class to no longer match, the AVM raises an error.
*The current position in the stream must be at the beginning of the data for the serialized object for the deserialization to complete successfully.

See also

Serialize( ) method (BinarySerializer)