On 2/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:

On 2/12/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> hmmm
> so if you have something like this
>
> class A {}
> class B { private A a; private A aprime; }
>
> when you serialize B does it write the class header for A once or twice?
> because i think that header has the classname so it would be output
twice
> no? last time i checked the header was a bit over 100bytes. so if it
does
> write it twice and you keep a local toc then you save yourself that
second
> 100+ byte class header

AFAIK, JDK's serialization writes headers once and then references.


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
when you serialize B is it
[B-header][b-data [A-header][B.a data][A-header][B.aprime data]]
or does it also do what we do and keep some kind of toc so that it looks
like
[B-header][b-data [A-header][B.a data][A-header-pointer][B.aprime data]]

because that is kinda what johan is doing, creating pointers to class
headers instead of writing them out all the time.

-igor


Eelco

Reply via email to