• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why we need externalizable interface in java

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I know the Concept of serliazation and externalization, apart from this concept i have one doubt about externalization,


1. we have option to control serlization using transient keyword then why we need of externalizable interface.I feel both are doing same work.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct. But Externalizable is an old interface. It is retained to maintain compatibility with very old Java code. New code should rarely, if ever, need it.

Serializable, and the related serialisation concepts, are the way forward, for new code.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think Externalizable has in any way become obsolete (of course, it has had only limited use from the beginning). transient merely controls whether a particular field is serialized or not, while implementing Externalizable allows complete customization of the serialization process. Although I've never had to use it, I don't see which new feature would have replaced it.
 
Peter Chase
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Serialisation can do everything Externalisation can do, can't it? There are numerous hooks into Serialisation, so you can make it do almost anything you like. For instance, you certainly can serialise transient fields - it's only default serialisation that doesn't do that.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Externalization is a hook into serialization -- it was introduced as part of the Serialization architecture; it's not any kind of an older API. It's what you use if you want to be 100% responsible for the bits written for a given class.
 
Peter Chase
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really?

OK. I learnt something. Not that I expect to find any uses for Externalizable...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic