J.Pietschmann wrote:

[EMAIL PROTECTED] wrote:

While looking into this code, it looks like the FopImageFactory opens up a
stream to the image using the URL class, then the specific ImageReader
implementation reopens the stream again. So, if I did a REST style interface
to generate my images, it looks like it would be called twice.


It depends on the image format, for some formats, the image reader
tries to reuse the stream.

 Am I missing
something here?  It looks like this is a little inefficient.


The problem is that some stock image readers only accept a
stream with the pointer at the begin of the content, and if
the stream pointer can't be reset (e.g. if the analyser needed
so much info that the underlying implementation already discarded
buffers), then the stream has to be reopened.

If you want to donate an intelligent buffering system....

J.Pietschmann


I apologize if I came across as accusational. I was trying to understand the code so I knew the ramifications of creating a REST style interface for my dynamically generated images. You have answered my question.

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.

If I implement somethign like this, I would happily donate it back.

Thanks,

Irv

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



Reply via email to