Serialization means Writing State of an Object in to Byte Stream.In Which situation we have to write an object in to byte stream Any one can tell me exact answer. Thanks..
In an effort to help you get the most from our forums, we've compiled a list of tips for asking questions here. You can find the list in our FAQ section here. In particular please see: Carefully Choose One Forum/
One reason very well known is RMI (Remote Method Invocation). With this technology it is possible that two separate JVM (Java Virtual Machine) transfer objects between each other.
In order to achieve this, many objects are serialized and transfered through the wire back and forth between the the two JVMs.
You could use serialization also to save the state of an application, so that when the application restarts you can recover to the particular moment when the application was closed.
And I am pretty sure many other could suggest dozens of other uses for serialization. [ December 21, 2006: Message edited by: Edwin Dalorzo ]
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
Think of serialization any time you want to send an object over some path that isn't a real method call. As mentioned before you can send that byte stream to another computer over the network whether RMI, raw sockets or JMS, write it to a file or a database, or whatever you need.
Java's "serialize" operation generates a special Java format, but we use the word "serialize" to talk about converting your object to and from XML or CSV or delimited strings or any other format.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Md. Mohd
Greenhorn
Joined: Apr 11, 2006
Posts: 12
posted
0
The real use of serialization is whenver you are transfering some data on the n/w. Lets say that there is an application that works with Mobile and server . The mobile phone acts as the client for such application. Now in this case if the mobile/user request some data from the server on the device , then the data that is sent from the server must be in the exact order as it was on the server . Thus to achieve this goal serialization is required.
Serialization is a very important concept. This proves a bliss in java when we are transferring data over network. Object serialization helps us when we need to transfer a file to a remote location. A serialize object is converted to a Byte Stream say a ByteArray[] then the recieving end converts the byte array to an object by deserializing the same.
adhir.
Chris Ringer
Greenhorn
Joined: Dec 04, 2006
Posts: 7
posted
0
So, just curious, what happens if an object (MyNeatClass version 1.0) is serialized and then before deserialized, someone installs a newer version of the class (MyNeatClass version 1.1) on the system? How does deserialization handle that? Thanks.
Chris
Edwin Dalorzo
Ranch Hand
Joined: Dec 31, 2004
Posts: 961
posted
0
Well, Chris, what happens may depend on several things.
think of this. you wrote a simple gaming program and when the user tries to close it, the user wants to start next time where he left off. These kind of things you can achieve using serialization