1) A class should implement
java.io.Serializable interface. (gives
compiler an indication)
2) SerialVersionUID JVM
generates its based upon structure of class which depends upon
interfaces a class implements and several other factors. SerialVersionUID
is used for version control of object.
serialVersionUID
mismatch leads to java.io.InvalidClassException.
3) Externalizable - Flexibility to control the serialization. using right/readExternal()
4) serializing not include some of the members can be achived using static variable or transient variable.
5) Custom serialization are possible, But should take care of Provate methods, Overloading and overriding, Since the private methods reading possible only from JVM, Still what is the need for custom serialization.
6)
To
avoid java serialization
you need to implement writeObject() and readObject() method in your
Class and need to throw NotSerializableException from those method.
No comments:
Post a Comment