Using Serialization with a Custom Data Format (original) (raw)
Abstract
Demonstrates how to use the writeObject andreadObject methods to encode a custom data format. When there is a large amount of persistent data, that data should be stored in a convenient, condensed format, such as the one used in this example.
This example uses a triangular array, a symmetrical, 2-dimensional array. During serialization only half of the array is saved. This example serializes half of the array inwriteObject, then restores the whole array inreadObject by deserializing half of the array and copying to restore the other half of the array.
This example differs from the Using Serialization and the Serializable Fields API Example in that this example does not support versioning. In addition, because this example does not use anExternalizable interface, superclasses are not a consideration.