On Mon, 2002-11-04 at 00:36, Peter B. West wrote:
> Keiron,
> Re your latest commits, could you comment on what you had to do to "make 
> sure area tree is serializable"?  I have been curious about aspects of 
> the serialization of trees for some time now.
> Peter

Hi Peter,

As you probably know the serialization is used so that pages can be
saved in the case of storing the area tree or forward references.

Serialization is done by writing an object to an ObjectOutputStream.

The easiest way to actaully find out if an object is serializable is to
attempt to serialize it, if it isn't then it will throw a
java....NotSerializableException. By default an object is not
serializable unless it implements Serializable. Normally that is all you
need to do, implement the interface then it automatically can handle the
object and all objects/primitives within the class. It recursively
handles all referenced objects from the starting object.

For the area tree there where a couple of problems that I just fixed,
the basic link was referencing the PageViewport which is not
serializable and should not be since it is the parent of the starting
object. The key with that thing was that after deserialization it would
still be able to locate the same PageViewport, so a unique string is
used. Other changes where simply to make sure that objects that could be
used in the area tree, such as ColorType, implement Serializable.

Mostly it is quite easy. You can also implement a couple of methods to
handle the process differently for a particular object.

Keiron <- starting with the easy questions first

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to