Help the world stop coronavirus! Stay home!

Prev Next

Java / Java Serialization

When is the readResolve method called?

The readResolve method is called when ObjectInputStream has read an object from the stream and is preparing to return it to the caller. ObjectInputStream checks whether the class of the object defines the readResolve method. If the method is defined, the readResolve method is called to allow the object in the stream to designate the object to be returned. The object returned should be of a type that is compatible with all uses. If it is not compatible, a ClassCastException will be thrown when the type mismatch is discovered.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

What is Serialization in Java? How to create a serializable class in Java? Difference between Serializable and Externalizable interface in Java. Why do we need Externalizable interface? Is Serializable a marker interface in Java? Can a Serialized object be transmitted through network? Which variables are not serialized during Java Serialization? What is serialVersionUID in Java? Do we need to implement any method when using Serializable interface? What is transient variable in Java? Why static variables are not serialized in Java? Is Externalizable a marker interface in Java? What happens when one of the members of the class does not implement Serializable interface? How to prevent a child class from being serialized when it's parent class already implements Serializable interface? What are the compatible and incompatible changes in Java Serialization Mechanism? How to improve Java serialization performance? When to use Serializable versus Externalizable? List few alternatives to Java serialization. How do I serialize a collection in Java? Give more examples of compatible changes in Java serialization. Give few examples of incompatible changes in Java serialization. Which method is used during Serialization and DeSerialization process in Java? What is the value of a transient variable after de-serialization? Does having SerialVersionUID variable improve Java serialization performance? Is the constructor invoked when a Java object is de-serialized? How to generate a SerialVersionUID in Java? List few differences between Serializable and Externalizable in Java. Do primitive data types involve in serialization? What happens when a class does not define SerialVersionUID in Java? Is constructor of parent class called during DeSerialization process of child class? Difference between readResolve and readObject methods in Java serialization. How do I prevent deserialization process creating another instance of Singleton class? Is there any limit on the size of a serialized object? How do I serialize a third party library class in Java? How do I improve Serialization performance? When is the readResolve method called?
Show more question and Answers...


Comments & Discussions