java - Is it possible to serialize transient field of the class using my custom serialization or using Externalization? -
is possible serialize transient field of class using custom serialization or using externalization?
example: there class person
having name field transient
transient string name;
is possible serialize using below methods?
private void writeobject(objectoutputstream out) throws ioexception; private void readobject(objectinputstream in) throws ioexception, classnotfoundexception;
the answer yes if using custom serializaton. when custom serialization overriding writeobject
method, take control of serialization , can whatever want. can assign or use value of transient
field , can marshall along other class attributes.
Comments
Post a Comment