From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,b777be000a53166 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-30 13:56:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Reply-To: "James S. Rogers" From: "James S. Rogers" Newsgroups: comp.lang.ada References: <3E37E080.3080608@epfl.ch> Subject: Re: Streams and Access types X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Thu, 30 Jan 2003 21:56:24 GMT NNTP-Posting-Host: 12.86.34.226 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1043963784 12.86.34.226 (Thu, 30 Jan 2003 21:56:24 GMT) NNTP-Posting-Date: Thu, 30 Jan 2003 21:56:24 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:33621 Date: 2003-01-30T21:56:24+00:00 List-Id: "Simon Wright" wrote in message news:x7visw62wwu.fsf@smaug.pushface.org... > Stephen Leake writes: > > > Rodrigo Garc�a 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