hrm, so the default jdk serialization is also building a toc? interesting, thats what i wanted to know.
-igor On 2/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> no, this is different > > B b=new B(); b.a=new A(); b.aprime=new A(); > > they are different instances, i am talking about class headers not > references > the way jdk serialization works is that for every class it does something > like this > [class-header classname,etc][fields] > so what i want to know and dont really have time to look into is This: static class A implements Serializable { } static class B implements Serializable { private A first; private A second; private A third; private A fourth; } and this B b = new B(); b.first = new A(); b.second = new A(); b.third = new A(); b.fourth = new A(); Serializing b will first write out the class header for B, then, when it writes out B's fields, the class header for A the first time it encounters it, and then 3 times a just reference to the header (and bye for tag and an int for the reference. Maybe we're talking about different things here? But I'm sure Johan will be able to take care of it :) Eelco