Object Serialization

Sun’s serialization web page at http://java.sun.com/products/jdk/1.2/docs/guide/serialization/ includes a FAQ list, sample code, and the complete object serialization specification. The specification covers serialization as implemented in Java 1.2, which is mostly upward-compatible with the Java 1.1 serialization discussed in Chapter 11. An earlier prebeta specification that covers Java 1.0.2 serialization is posted at http://java.sun.com/products/jdk/rmi/doc/serial-spec/serialTOC.doc.html. A formal specification of Java 1.1 serialization was never published. However, the Java 1.2 spec is mostly the same, with the addition of a few extra features like the readResolve() method.

Sun’s formal specification for object serialization is not always clear, especially when it comes to motivating the more esoteric areas of serialization like ObjectInputValidation. However, it is complete and does add some to what I discussed in Chapter 11, including the binary protocol for serialized objects and .ser files.

Object serialization was originally developed to support Remote Method Invocation (RMI), an architecture that allows Java objects in one virtual machine to invoke methods on objects in another virtual machine, possibly running on a different computer somewhere else on the Internet. RMI is discussed briefly in Chapter 14 of my Java Network Programming and at great length in Jim Farley’s Java Distributed Computing (O’Reilly & Associates, 1998, ISBN 1-56592-206-9).

Object ...

Get Java I/O 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.