Deserialize from a file
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
To deserialize an instance:
- Instantiate a variable of type
Progress.IO.BinarySerializer(orProgress.IO.JsonSerializer). - Instantiate a variable of type
Progress.IO.FileInputStreamwith your target filename as a parameter. This class provides functionality for reading from the file. - Invoke the
Deerialize( )method of yourProgress.IO.BinarySerializerinstance and pass it the filename from which the object will be deserialized. The theDeserialize( )method returns an instance of typeProgress.Lang.Object, so you must use theCASTfunction to set the deserialized object to the correct type. - Invoke the
Close( )method of theProgress.IO.FileInputStreamobject.
The following code example shows myObj, an instance of
Acme.MyClass, being deserialized from a binary file
MyClass.bin. The corresponding steps are numbered with comments.
|
For full descriptions of all the classes and methods used in serializing and deserializing objects, see their entries in ABL Reference.