4.5. Explicitly Managing Serializable Fields
With default serialization, the mapping between class fields and stream fields is automatic and transparent. At serialization time, a field's name and type in the class become the field's name and type in the stream. The fields written by default serialization are called the default field data. At deserialization, a field's name and type in the stream are used to find the correct field to assign in the new instance.
The serialization API exposes hooks so that you can take control of any of these steps. Two nested classes do most of the work. ObjectInputStream.GetField allows you to explicitly manage pulling fields out of the stream, and ObjectOutputStream.PutField allows you to explicitly manage inserting ...
Get Component Development for the Java™ Platform now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.