Figure 9.1A Vector is sent to the client. Since Vector is not a remote object, a copy of the object is made on the client. The client program sends a Customer object to the server. Again, Customer is not a remote object, so a copy is made on the server. OutputFigure 9.2
The java.io.Serializable Interfacepublic interface Serializable{} This interface does not define any methods or fields. It serves only to identify the semantics of being serializable. During default serialization, any fields marked as transient or static will not be serialized. Classes that require special handling during the serialization and deserialization process must implement the following methods: private void writeObject(ObjectOutputStream out)throws IOException private void readObject(ObjectInputStream in)throws IOException, ClassNotFoundException; The java.io.ObjectInputStream ClassThis class is used to access objects that have been written to an ObjectOutputStream. In other words, it is used to deserialize primitive data and objects previously written using an ObjectOutputStream. An object is reconstructed by calling the readObject() method of this class.
The java.io.ObjectOutputStream ClassThis class is used to store serialized objects. Persistent storage of objects can be accomplished by using a file for the stream. Only objects that support the java.io.Serializable interface can be written to streams. The writeObject() method is used to write an object to the stream.
Serialization is a mechanism used to convert any object into a sequence of bytes that can be later reconstructed. The RMI system uses the object serialization mechanism to transmit data. The java.io.Serializable interface is used to tag objects, which can be serialized. It is important to note that serialized objects are always copies of the original object.
|
||
|
||
Copyright © 2001 www.universalteacher.com |
||