When your class implements Serializable interface, object serialization is automatic where you just need to call writeObject() and readObject() methods for serialization and deserialization . If you want to customize the serialization process with you having more control then you can use Externalizable interface in Java. Table of contents Externalizable interface in Java Externalizable Java example Serialization order in Java Externalizable interface in Java java.io.Externalizable interface extends Serializable interface and adds two methods of its own- writeExternal(ObjectOutput out) - To write object into a stream by calling writexxx methods for primitive types and writeObject method for objects. This flexibility to call write() methods for individual fields gives you control over the serialization process. readExternal(ObjectInput in) - To read object from stream by calling readxxx methods for primitive types and readObject method for objects. Any
Java, Spring, Web development tutorials with examples