I understood from this publication that Serializable is incredibly easy to implement and resilient to change (in most cases, all you have to do is update the serialversionUID). If we want to control the process of reading and writing, we can implement Externalizable.
If all we want is to control the process of reading and writing, we can override the methods below for serialization. Why do we need to introduce a new Externalizable interface?
private void writeObject(java.io.ObjectOutputStream out)
throws IOException
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;
private void readObjectNoData()
throws ObjectStreamException;
source
share