File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Serialization -  Seriallizable   Vs  Externalizable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serialization -  Seriallizable   Vs  Externalizable" Watch "Serialization -  Seriallizable   Vs  Externalizable" New topic
Author

Serialization - Seriallizable Vs Externalizable

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1368
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

Joined: Oct 01, 2001
Posts: 2771
    
  10

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

Joined: Oct 13, 2005
Posts: 36499
    
  16
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serialization - Seriallizable Vs Externalizable
 
Similar Threads
Externalizable
Serializable Vs Externalizable
Externalization vs. Internationalization
serialization's writeObject() vs Externalization writeExternal()
Externalizable vs Serializable with volatile fields