Difference between Externalizable and Serializable
- Serializable uses the default serialization process. while in the case of an equalized user process, Serialization is used, which is implemented by the application.
- The JVM returns a call to readExternel () and writeExternal () on the java.io.Externalizalbe interface to restore and write objects to persistence.
- The Externalizable interface provides complete control over the serialization process for the application.
- readExternal () and writeExternal () replace any specific implementation of the writeObject and readObject methods.
Although Externalizable provides complete control, it also creates problems for serializing the superuser state and takes care of the default values ββin the case of a transition variable and static variables in Java. Used correctly, the Externalizable interface can improve the performance of the serialization process.
So go to the Externalizable interface
If you have special requirements for serializing an object. For example, you may have some security-sensitive parts of an object, such as passwords, that you do not want to store or transfer anywhere. Or it may be useless to save a specific object referenced by the main object, because after restoration its value will become useless.
source share