This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Externalizable interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Externalizable interface" Watch "Externalizable interface" New topic

Externalizable interface


Joined: Aug 10, 2005
Posts: 29
what is the use of Externalizable interface?

thanks in advace,
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

Do you understand what Serializable is for? Externalizable is similar, but it gives you complete control over the format of the serialized data for a class -- i.e., you have to save all the data yourself.

[Jess in Action][AskingGoodQuestions]
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism. Thus if your class implements this interface, you can customize the serialization process by implementing these methods.
You can find a sample in here.
It is sorta covered in the JavaRanch Style Guide.
subject: Externalizable interface
It's not a secret anymore!