+ 5
What is serialization in java
In the google it's like it is a process to convert object into byte array... Why are we converting it? .. What's the use of converting? Pls explain in a simple words
8 Respostas
+ 23
It is useful when you want to save the object you are working with.
Any objects you create in your program are stored in memory, which is cleared once your program is closed.
This becomes a problem when you want to save the state of your object for the next launch of the program.
So, here comes the serialization. Basically, it makes it possible to save object into a file or database (uncommon).
+ 16
Benjamin Jürgens Sure, it is uncommon. But, as you said, it is possible. This is why I mentioned a database.
+ 3
Igor Makarsky to save serialized data in a database is very uncommon. You can do that of course (as a BLOB), but for the most part you have one table for every type of object and map each object property to a DB column
+ 2
Karthik Reddy Thotamgari you serialize Java objects that you have in your running Java program. The major use cases are:
- To transmit it. Transmission is done as a byte stream
- To save in a file as array of bytes
+ 2
Just now I've read about serialization in google... That means the process of converting obj state into persistent (permanent) state... To use serialization the class must implement Serializable... And the file must have extension (.ser) ..
0
To transmit or save in a file
0
U mean transmission of file?
0
serialization - the process of transmitting the object to an array of byte
deserialization - the reverse process of serialization ie, an array of bytes to an object
why: we can reuse this state of an object when needed if it is stored in a file or a database in the stream of bytes(file with .ser extension).