What is deserialization and how do we do deserialization?

Answer Posted / javamasque

Deserialization is a process of retrieving object from byte stream. We have to fallow below steps for de-serialization
1. The object to be serialized need to implement java.io.Serializable interface.
2. It will use Java’s default serialization mechanism.
3. Generate serial version id for that serializable object.
4. Only default constructor is applicable to all class hierarchy (from child to all super classes if any). It is necessary at deserialization otherwise throw InvalidClassException.
5. Generate serial version UID for all super classes in hierarchy (all super classes if any) otherwise the properties of all its super classes will be assigned to its default value during deserializtion.
6. ObjectInputStream is used to read [readObject()] object.
7. FileInputStream is used to read from flat file.
8. The flat file extension should be (<file-name>.ser)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can arraylist contain null values?

745


List implementations of list interface?

790


How can we use primitive data types as objects?

732


Why string is called as immutable?

715


What are the main uses of this keyword?

806


What does pointer mean?

749


What is floor math?

686


What is the purpose of finalization in java programming?

786


Write a method to check if input string is palindrome?

767


How to access arraylist elements in java?

699


What are the two types of java?

754


What is method overloading in JAVA? Why is it not present in C ?

794


What is a singleton factory?

720


What is singletonlist in java?

708


What is sorting in java?

733