Object I/O

The ObjectOutputStream and ObjectInputStream classes enable objects and values of primitive types to be written to and read from streams. These classes implement the ObjectOutput and ObjectInput interfaces. Of the methods specified by ObjectOutput, the writeObject() method is the most interesting; it writes objects that implement the Serializable interface to a stream. The ObjectInput interface provides the readObject() method to read the objects written to a stream by the writeObject() method.

When an object is stored in a serialized form, information is stored with the object that identifies the Java class from which the contents of the object were saved and allows the object to be restored as a new instance of that class. In addition, ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams 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.