You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Peter B. West" <pb...@powerup.com.au> on 2002/11/04 00:36:41 UTC

area tree is serializable

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
-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: area tree is serializable

Posted by Keiron Liddle <ke...@aftexsw.com>.
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: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org