Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is serialization  RSS feed

 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read somewhere that if you serialize an object, its converted into XML and sent across the network OR stored on harddisk. And vice-versa i.e. XML is converted back to object OR read from harddisk. Is this the way Serialization OR Deserialization works? I am a bit confused about Serialization, Will someone please elaborate on this.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Serializing an object means to convert it to a representation that can be transferred outside of the JVM. It does not depend on whether the target is the filesystem or a network connection to a remote host.

There are different ways of serializing an object, e.g. the java.io.ObjectInputStream/ObjectOutputStream classes (which produce a representation that can be used by Java only), or the XML-based java.beans.XMLEncoder/XMLDecoder classes, or something else entirely that you come up with.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will also see the words marshalling and unmarshalling in serialization discussions. That just refers to converting objects into some transmittable form and back.
 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanking you for your suggestions. But Still I am bit confused about the internal operation of serialization. While converting object into stream, how is its state maintained. What exactly happens when an object serialized. Is it converted into something, which is given serial number OR something like that. If possible, please throw some light over this.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a section on Object Serialization in the release notes to the J2SE. It has links to examples, a FAQ, and if you are really curious, the Object Serialization Specification.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!