File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serialization - Seriallizable Vs Externalizable

 
kri shan
Ranch Hand
Posts: 1453
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a). Which is the optimized way(Seriallizable Vs Externalizable) of doing serialization?
b). If i use transient / volatile fields in serializable class any difference in using Seriallizable and Externalizable.
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably Serializable will work best for you. Externalizable is a subinterface of Serializable, which gives you more control over how your objects are serialized and de-serialized ... though at the expense of having to write a lot more code yourself.

The volatile keyword doesn't affect serialization in any way. Member variables marked transient are not serialized from normal Serializable classes, but for Externalizable classes, you decide what gets serialized and what doesn't, so it seems to me that the transient keyword wouldn't do anything.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47242
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See whether you can find a copy of Bruce Eckel's Thinking in Java, which has a chapter about serialisation. The 3rd edition used to be available free of charge on the Net.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic