Section 15.5 Object Serialization

• Java provides a mechanism called object serialization (p. 662) that enables entire objects to be written to or read from a stream.

• A serialized object (p. 662) is represented as a sequence of bytes that includes the object’s data as well as information about the object’s type and the types of data it stores.

• After a serialized object has been written into a file, it can be read from the file and deserialized (p. 662) to recreate the object in memory.

• Classes ObjectInputStream (p. 662) and ObjectOutputStream (p. 662) enable entire objects to be read from or written to a stream (possibly a file).

• Only classes that implement interface Serializable (p. 663) can be serialized and deserialized.

• The ObjectOutput ...

Get Java™ How To Program (Early Objects), Tenth Edition 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.