🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #549

Re: TreeMap serialization

#549
From: Kevin Dean
Date: Tue, 03 Jun 2003 23:28
52 lines
2830 bytes
Most if not all of the Java collection classes handle their own
serialization regardless of the member variables and their declarations.  In
the case of Map-type classes, they typically write an integer indicating the
number of entries followed by the key-value pairs.  That way, the output
stream is not cluttered with redundant or useless information.  The internal
representation of the collection class is rebuilt when the object is
deserialized.

See the writeObject() and readObject() methods in the TreeMap source for
details.

-- 
Check out our latest white papers at
http://www.datadevelopment.com/papers/index.html

BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server

Dolphin Data Development Ltd.
http://www.datadevelopment.com/

"George" <geo54321@hotmail.com> wrote in message
news:3edcc0f4$1@newsgroups.borland.com...
> By reflection, I find that java.util.TreeMap has the following fields
>
> 0     comparator             java.util.Comparator
> 1     root                        java.util.TreeMap$Entry      transient
> 2     size                         int
> transient
> 3     modCount               int
> transient
> 4     entrySet                  java.util.Set
> transient
> 5     RED                       boolean
final
> static
> 6     BLACK                 boolean                                final
> static
> 7     serialVersionUID    long                                    final
> static
>
> Except for the comparator field (field 0), everything else is either
> transient or static (which as I understand are modifiers ignored by
> serialization).  So how does serialization work?
>
> I ask because I am trying to write a class to store the contents of a
given
> object in XML and I'm not getting any data to store for TreeMaps.
>
> TIA.
>
>
Technical Details
Message-ID: <3edd2fc6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3edcc0f4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,d5d05c76cc28ee2b
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2003-06-03 16:39:22 PST
From: "Kevin Dean" <NkOdSePaAnM@datadevelopment.com>
Newsgroups: borland.public.jbuilder.java.api
References: <3edcc0f4$1@newsgroups.borland.com>
Subject: Re: TreeMap serialization
Date: Tue, 3 Jun 2003 19:28:26 -0400
Lines: 54
Organization: Dolphin Data Development Ltd.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 24.57.150.243
Message-ID: <3edd2fc6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1054683078 24.57.150.243 (3 Jun 2003 16:31:18 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail