aspose file tools*
The moose likes Java in General and the fly likes how can we create new object using de-serlization in java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how can we create new object using de-serlization in java ?" Watch "how can we create new object using de-serlization in java ?" New topic
Author

how can we create new object using de-serlization in java ?

Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
We know 4 ways to create Objects in java
using
1) New
2) clone()
3) class.forName()
4) de-serlization

My question is how we can implement so that we get new object using de-serlization.

Regards,
Prabhat
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1761
    
    7

Strictly speaking, deserialization does not create a new Object. It simply restores a previously created object from a serialized state.
This can be accomplished using an ObjectInputStream. Have a look at the API documentation, it should contain a very simple example of how to go about the deserialization process.
If you would like to know more about object serialization / deserialization, you could check out the java tutorial and this article.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
Thanks for your good reply..There is some post in internet where i read it and someone expecting to know how it is working internally.


the above code is does the de-serilzation process. right ?

so in some article is was told that , please go through the below url for the same
http://www.geekinterview.com/question_details/37647
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

Please use code tags for code, not quote tags. And while you're at it, please preserve indentation. I've modified your post so it's better readable now.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can we create new object using de-serlization in java ?