Monday, June 16, 2003 05:17 AM
Serialization is basically another word for object "persistance". It is the marshaling/unmarshaling of an object to another form that may be "persisted".
The implications of this, however are really powerful.
Those classes that are "serializable" implement the "Serializable" interface. This interface has two methods.
private void writeObject(java.io.ObjectOutputStream out)
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;
Read the JavaDocs on this, but by implementing this method a calling class or container or the JVM may serialize the object. How you implement this serialization or handle the IO Stream is up to you.
Referencable just means that you can reference the object.
But it has an implication in dealing with remote object calls, like EJBs or RMI etc.
When you access a remote object, you need to be able to reference that object. Each Remote Method call has different ways of setting up the connection, BUT the object, parameters you pass to the method and values/objects that are returned, must be serialized.... It must be translated into some type of information that can be passed across the "connection". This can be a byte stream, or whatever, but Objects are not passed across a connection, the information about the Object is. There has to be an object on the receiving end that correcsponds to the object on the sending end.
You can serialize a connection class, but you are not preserving the connection, you are just serializing the information about the connection.
Hope this helps.