This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Serialization in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Serialization in Java" Watch "Serialization in Java" New topic
Author

Serialization in Java

Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi All,
Could anyone please help me to know real world example of where serialization is required.
Actually i'm looking for where persistent data is used in real world application, but i think need of serialization would also help me in clarifying this?

I tried to find on google but did not satify.

Please help in this.

Thanks in Advance.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

There might be many uses of serialization. You can use it to transfer data from one machine to another or use it as a replacement to a DB (although there are many features in a databases which are not in serialization)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2231
    
    7

Jay Shukla wrote:Could anyone please help me to know real world example of where serialization is required.
Actually i'm looking for where persistent data is used in real world application, but i think need of serialization would also help me in clarifying this?


Hmm There are many real examples when you need serialization. Bank account withdrawals, database modification, etc.

Persistent data? That would be what I'm been doing lately I guess. Imagine a plain file and many clients accessing this file wanting to read and modify data in it. If the read/modify is not synchronized, clients will deadlock waiting to read/modify data because clients are waiting for the lock of the object in order to continue.

Hope this helps.

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
Serialization is never "required" - there are always other ways of achieving the same purposes. Long-time persistence in particular is not something I'd use serialization for.

Note that Java has two built-in serialization mechanisms: the binary Java-only way using the Serializable interface and Object[In|Out]putStream, and the XML way using java.beans.XML[De|En]coder classes if the Java object follow JavaBean semantics.


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Serialization in Java
 
Similar Threads
What are the advantages of serialization?
Professional Projects
Context that requires Thread
What is Serialization?
What is the use of serializable beans in jsp file?