Irv Salisbury III wrote:

> It seemed like most of the readers would read the image into memory.  
> So, one thought on an "enhancement" might be to always read 
> the bytes in from the URL and then just hand that off instead 
> of opening the URL again. 
> 
> Of course, this doesn't allow for future enhancements where 
> it doesn't need to read the whole thing into memory. 

Hi Irv:

I spent the last couple of days refactoring my graphics package (not FOP,
but derived from FOP) a bit. It needed to be done anyway, and your question
gave me a good excuse to dive in. The upshot is this:
1. As you have suggested, I have changed most of the Readers (Factories in
my package) to open the stream once in most cases, read what it needs, and
reset. One of them (I think TIFF) still opens another stream later. That can
probably be fixed also, but I don't have time to do it now.
2. More importantly, I replaced all of the class-loading stuff with
pluggable factories, which means that you can create your own factory,
register it, and, as the URL goes by, have it look at it to decide if it is
one of your special cases. If so, create a Graphic instance that talks to
your own classes, and you are on your way. The method that makes the Graphic
instance (i.e. that manages the Factories) has a boolean that can be set to
either cache the instance or not.

If you decided to use any of this, you still have the non-trivial task of
integrating my work back into FOP's code. It is very doable, but it will
probably take some time. I'm not really suggesting that this is an efficient
way to go -- I just wanted to let you know that it an option. You can see
the code here:
http://cvs.sourceforge.net/viewcvs.py/foray/foray/foray-graphic/src/java/org
/foray/graphic/

Email me off-line if you need help finding out how to download the code.

Victor Mote


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

Reply via email to