|
|
|
|||
|
Object SerializationTwo streams injava.io--
ObjectInputStream and ObjectOutputStream--
are run-of-the-mill byte streams
and work like the other input and output streams.
However, they are special in that they can read and write objects.
The key to writing an object is to represent its state in a serialized form sufficient to reconstruct the object as it is read. Thus reading and writing objects is a process called object serialization. Object serialization is essential to building all but the most transient applications. You can use object serialization in the following ways:
ObjectOutputStream
and reading them in again using an ObjectInputStream.
The next section,
Serializing Objects, shows you how.
Second, you will want to know how to write a class so
that its instances can be serialized. You can read how to do this in
the section after that,
Providing Object Serialization for Your Classes.
| |||
|