• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object serialization  RSS feed

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every body ,
I have a query :

Which one is good for object serialization ? should I go for serializable or externalizable ? why ?

Please give some example .

regards,
S
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

should I go for serializable or externalizable ? why ?


What is your requirement ? It is hard to comment on what you should choose without knowing what the problem is. Or do you simply want to know the differences between serialization and externalization ?
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks bala , for your reply ,
I want to know the difference of these two and where I will use one of them , I mean to say at what situation I will use serializable / externalizable Interface.

regards,
S
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Externalization requires more work. You need to define what is to be serialized and how inside your class, but this approach is more flexible and you have more control. With serialization you shift some of the work to default implementations, which leads to less work and lower levels of flexibility.

I have never used externalization at work since I never found the need to. If some one here has, they will add a reply.

The javadoc is a great source of info about the process in general

http://java.sun.com/j2se/1.4.2/docs/api/java/io/Externalizable.html
http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!