Serialize( ) method (BinarySerializer)

Serializes an ABL class-based object to the specified binary stream.

Return type: VOID

Access: PUBLIC

Applies to: Progress.IO.BinarySerializer class

Syntax

Serialize ( INPUT object-reference AS Progress.Lang.Object,
            INPUT output-stream AS Progress.IO.OutputStream )
object-reference
The class-based object to be serialized.
output-stream
The stream to which the object-reference is serialized.

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