What is the use readObjectNoData in Serialization in java? Please explain with an example?
The java docs are not clear.
What is the use readObjectNoData in Serialization in java? Please explain with an example?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Quoting from “Effective Java”:
In case you’re curious, the readObjectNoData method was added in release
1.4 to cover a corner case involving the addition of a serializable superclass to an
existing serializable class. Details can be found in the serialization specification
[Serialization, 3.5].
If you implement a class with instance fields that is serializable and extendable,
there is a caution you should be aware of. If the class has invariants that
would be violated if its instance fields were initialized to their default values (zero
for integral types, false for boolean, and null for object reference types), you
must add this readObjectNoData method to the class:
Hope this helps…