Net-informations.com
SiteMap  | About    

Why to use serialization in Java?

Serialisation is used in the cases where you want to save an object state and convert that object into byte stream, objects need to be serilazed. While you're running your application, all of its objects are stored in memory (heap memory). When you exit, that memory gets reclaimed by the operating system, and your program essentially 'forgets' everything that happened while it was running. In these types of situation , you can use Serialization by letting your application save objects to disk so it can read them back the next time it starts. If your application is going to provide any way of saving/sharing a previous state, you'll need some form of serialization .

Whenever an object has to send over the network , those objects should be serialized. For example, if you have two machines that are running the same code, and they need to communicate, an easy way is for one machine to build an object with information that it would like to transmit, and then serialize that object to the other machine. It's not the best method for communication, but it gets the job done with serialization.

Cross JVM Synchronization - Serialization works across different JVMs Java Virtual Machine that may be running on different architectures.







net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.