Extending basic serialization in Java: when the automation of
Serializable is not enough, the manual contract
Externalizable with methods
writeExternal/
readExternal comes to the rescue. In this lecture, we examine how to fully control the data format, reduce file size, and maintain backward compatibility; we compare it with the streams
ObjectOutputStream/
ObjectInputStream, and show examples, pros/cons, and common pitfalls (the required
public no-arg constructor, write/read order, etc.).