Serialization, deserilaization, Serializable, Externalizable interface in readExternal, writeExternal methods

Serialization is a process of saving the state of an object to a stream. It is used for Remote Method Invocation (RMI). As the name suggests by using Remote method invocation you can call a method remotely from another system. After serialization if you wish to restore the objects you can do it by deserilaization.

Serializable interface: To use the process of serialization in, Serializable interface is used. It has no members of its own. It is used to show that a class is serializable.

Externalizable interface: It is used to control serialization and deserilization process. Methods defined by Externalizable interface:

readExternal( ) method: It is used to read an object.


void readExternal(ObjectInput istream) throws IOException, ClassNotFoundException

writeExternal( ) method: It is used to write to an object.


void writeExternal(ObjectOutput ostream) throws IOException

Leave a Reply