• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serialization

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i am not able to understand how serialzation works and where we are using this concept
 
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi anita,
I can clear your doubt to some extent,below shown is a link.

http://www.oreilly.com/catalog/javarmi/chapter/ch10.html

 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Serialization is preferred when you want to persist the state of the object.

That means saving the state of the object into a permanent storage. Say, into a file in the disk.

State of the Object means the values of instance variables of the object you are serializing excluding the variables which are declared as 'transient'.

  • Serialization - process of storing the state of object into a permanent stoage
  • Deserialization - reverse process; process of restoring the state of the object from the permanent storage


  • Important points to note:
    ------------------------
    (a) Its mainly used when you do with RMI - Remote Method Invocation wherein you are supposed to pass the object into the network - over wires (streamlined version). Basically the objects should be of serializable in nature.
    (b) The class whose instances gonna be serialized - should implement the interface java.io.Serializable.
    (c) You can do the serialization and deserialization through the read() and write() methods.

    Hope it clears now.

    There are many more aspects with respect to serialization, which you can read it in tutorials, articles later. Just google it.
    [ May 24, 2007: Message edited by: Raghavan Muthu ]
     
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This link gives an explanation of Serialization with a good example.

    It works good for Java SE 1.4.2. Try this.

    Good luck.
     
    (instanceof Sidekick)
    Posts: 8791
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I'd modify Raghavan's explanation a bit to replace "permanent storage" with "any stream". The stream can go to or from anywhere ... disk, a String in memory, over the network, anything else you can imagine.

    The term can refer to the general problem of sending data structures over a stream. We can use the same words - serialize and deserialize - for writing object state out to XML, JSON, CSV or some proprietary format and reading it back.
     
    Raghavan Muthu
    Ranch Hand
    Posts: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for the correction Stan James.

    Yes, you are right
     
    Your mind is under my control .... your will is now mine .... read this tiny ad
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic