站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.4.1, Java 2 SDK 英文文档

Using Serialization with a Custom Data Format - JDK 5 Documentation v1.4.1, Java 2 SDK 英文文档

Using Serialization with a Custom Data Format

Abstract

Demonstrates how to use the writeObject and readObject 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 in writeObject, then restores the whole array in readObject 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 an Externalizable interface, superclasses are not a consideration.

Additional Information

Source Files
Running the Example
List of Examples