comp.lang.ada
 help / color / mirror / Atom feed
From: "James S. Rogers" <jimmaureenrogers@worldnet.att.net>
Subject: Re: Streams and Access types
Date: Thu, 30 Jan 2003 21:56:24 GMT
Date: 2003-01-30T21:56:24+00:00	[thread overview]
Message-ID: <cch_9.12999$rq4.931843@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: x7visw62wwu.fsf@smaug.pushface.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

"Simon Wright" <simon@pushface.org> wrote in message
news:x7visw62wwu.fsf@smaug.pushface.org...
> Stephen Leake <Stephen.A.Leake@nasa.gov> writes:
>
> > Rodrigo Garc�a <rodrigo.garcia@epfl.ch> writes:
> >
> > >    One solution is to do custom serialization but, does anybody knows
> > > of an Ada compiler that can automatically serialize the objects
> > > pointed by access variables (recursively if needed, such in the case
> > > of the linked list)?
> >
> > This is not possible in general. How would the compiler resolve a
> > circular list? All doubly-linked lists have circles, so it is a real
> > problem.
>
> Clearly this can be done! Java does it (unless I'm mistaken). You have
> to keep track of what's been serialized already, I suppose.

Java serialization is actually a bit more complicated than you imply.
Only the classes that implement the Serializable interface may be
serialized. Java classes that need to control the serialization process
have several possible approaches.

The first approach is to override the readObject() and
writeObject() methods. These methods allow pre and post
processing to be done for the serialization process.

The second, and more powerful approach, is to implement
the Externalizable interface, which extends the Serializable
interface. All classes are tested by the serialization mechanism to
determine if they implement the Externalizable interface. This
interface declares two methods: readExternal() and
writeExternal(). These methods are often used to perform
encryption, or handle other algorithms, including writing data
in a special format.

Jim Rogers





  reply	other threads:[~2003-01-30 21:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-29 14:09 Streams and Access types Rodrigo García
2003-01-29 19:51 ` Stephen Leake
2003-01-30 20:41   ` Simon Wright
2003-01-30 21:56     ` James S. Rogers [this message]
2003-01-31 11:13     ` Rodrigo Garcia
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox