4.4. Matching Streams with Classes

Serialization may involve loading classes if the instance being deserialized is of a type not already present in the virtual machine. The design for how classes are loaded is simple. The common case works without any special effort on the part of the programmer; the current class loader is simply asked to load the class whose name matches the class name in the serialization stream.

When deserialization triggers class loading, there are two problem cases to worry about. When the runtime attempts to load a class to deserialize an object, it might find a different version of the class than the one that serialized the object, or it might not find the class at all. This section will cover the former problem; the ...

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.