+ 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

11th Apr 2021, 7:28 AM
kreddyt
kreddyt - avatar
8 Antworten
+ 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).
11th Apr 2021, 7:39 AM
Igor Makarsky
Igor Makarsky - avatar
+ 16
Benjamin Jürgens Sure, it is uncommon. But, as you said, it is possible. This is why I mentioned a database.
11th Apr 2021, 8:11 AM
Igor Makarsky
Igor Makarsky - avatar
+ 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
11th Apr 2021, 7:53 AM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 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
11th Apr 2021, 7:47 AM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 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) ..
11th Apr 2021, 9:43 AM
kreddyt
kreddyt - avatar
0
To transmit or save in a file
11th Apr 2021, 7:33 AM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
U mean transmission of file?
11th Apr 2021, 7:35 AM
kreddyt
kreddyt - avatar
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).
30th Jul 2021, 2:10 AM
Arunaa G T
Arunaa G T - avatar