Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Need of Externalizable  RSS feed

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
externalizable has methods readExternal and writeExternal which you override
now within these methods
you are using objectoutput's methods only right?
so what is the need of this interface anyway?
you can in your program anyway write directly ObjectOutputStream.writeXXX methods right?
 
author
Sheriff
Posts: 23586
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Kartik Patel:
Hi,
externalizable has methods readExternal and writeExternal which you override
now within these methods
you are using objectoutput's methods only right?
so what is the need of this interface anyway?
you can in your program anyway write directly ObjectOutputStream.writeXXX methods right?



Externalization is a different way to "serialize" an object. When an object is serializable, it follows a particular way to convert the object into a bitstream and back. You can change it a bit by implementing readObject() and writeObject(), but basically, you are doing it only for the class in particular. The base classes will be handling their own serialization.

With Externalizable, the complete object, for that class, and its superclasses' is converted to the bit stream. The writeExternal() is responsible for the whole object at that point, including the base classes. On the read side, the default no-args constructor will be used, and then the readExternal() is responsible for the configuration of the instance.

Henry
[ February 26, 2007: Message edited by: Henry Wong ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!