classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch: Code to dump serialized objects


From: Bryce McKinlay
Subject: Re: Patch: Code to dump serialized objects
Date: Fri, 03 Nov 2000 21:27:08 +1300

Warren Levy wrote:

> Folks,
> I've instrumented java.io.ObjectInputStream to work as a serialized object
> dumper by reworking the commented out debug statements in the module.
>
> Now, if you've configured with --enable-libgcj-debug and call the static
> method java.io.ObjectInputStream.setDump(true); you will see the contents
> of the serialized object printed out for you as it is deserialized with
> readObject().  This can be useful if you are trying to implement
> serialization for a special case class and you're trying to understand
> the (sometimes limited) Serialized Form doc better.
>
> I've made the code conditionally compiled this way to optimize things a
> little bit and to avoid this accidently being turned on in production
> code.  Enjoy!

Hi Warren,

This sounds cool! However, since we're trying to create a _compatible_ Java 
implementation, adding new public methods to the
standard classes is a bad idea!

Instead, I would suggest that this stuff gets activated via a system property 
(eg "gcj.dumpobjects") that can be set either by
calling "System.setProperty()" or by using the -D option at compile-time.

Even better, why not make a small utility (ala 'jcf-dump') that hooks into 
ObjectInputStream and gets installed with libgcj, ie
'ser-dump' or something?

regards

  [ bryce ]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]