What is the use of serialization?

Possible duplicate:
What is object serialization?

I know the details of how the JVM serializes object graphs. I'm more interested in using serialization? What was the need for serialization specification? More specifically, what is the practical use of serialization these days? Is used as a means of storing data? Or is it used to send data over a network?

I will be grateful for any links to this question if a complete answer is not possible.

Thanks in advance.

+4
source share
3 answers

Very simple. Suppose you have a graph of objects and want to save it in a file and then read it back. The success of the Java programmer is that he / she does not need to enter detailed field data and data records. If the entire graph consists of serializable objects, java does this for you.

The same thing matters if 2 applications share data.

+2
source

Serialization is mainly used to send objects over the network. It is used in RMI, Spring HttpInvoker, and other binary remote method call systems.

Using it for long-term permanent storage is questionable because it is impossible to query, binary and therefore difficult to parse with a simple text editor, and it is difficult to maintain when classes change, and their serialization format changes in this way. Therefore, a more open format (XML, JSON, etc.) is often chosen.

+1
source

Yes and yes! You can use it to send objects over the network, cache them, save them to disk, no matter what you like. It is used for things like session replication between clustered JVM instances. In most cases, it is used under the covers of libraries that you also use.

0
source

All Articles