4.8. Object Replacement

Both object streams and objects themselves have the ability to nominate replacement objects at serialization time. This object replacement feature has many uses. If your object graph contains an object that is not serializable, you can replace it with an object that is serializable. If you are doing distributed programming, you can replace an object's state with an object's stub, causing the receiver to get a reference to the remote object, instead of a local by-value copy of the object. RMI uses object replacement for this purpose. Replacement may also be useful if you want to add additional semantics to serialization that go beyond the capabilities of the readObject and writeObject methods.

4.8.1. Stream-Controlled Replacement ...

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.