You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jeff Vannest <Je...@jandrconsult.com> on 2007/03/12 22:52:30 UTC

out.flush()

Will someone add "out.flush()" to the embedding example on the FOP
website...for example, at
http://xmlgraphics.apache.org/fop/0.93/embedding.html?

It seems a shame that everyone embedding FOP learns to flush() by trial and
error.

Thanks!
Jeff




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: out.flush()

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Interesting. I think I shall try to reproduce the problem in a quiet
moment.

Thanks for the code snippet. A note on that: I consider it better style
to put the close() in a finally section so you don't have to make sure
that the close() is called in every situation (exception or not).

On 13.03.2007 01:28:17 Jeff Vannest wrote:
> Closing the buffered out without flushing causes the PDF file to be closed
> before all data is written to it. Originally when I started working with the
> embedded FOP I had this problem...adding the flush got rid of the problem
> completely.
> 
> Another user had the same problem and reported it on 3/6/07 in a message
> titled, "FOP 0.93 generated a damaged PDF File". Liam responded on 3/7/07 to
> do a flush before the close.
> 
> According to
> http://java.sun.com/j2se/1.4.2/docs/api/java/io/FilterOutputStream.html#clos
> e(), the flush() should be implicit, which agrees with your response.
> 
> On a possibly related note, I only experienced the problem within the
> context of my servlet, never on my local system, so I'm not ruling out a
> java bug.
> 
> Jeff



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: out.flush()

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
That's the first time I head someone mention that. Why do you think this
is necessary? The example uses a try..finally calling out.close() in the
finally section. This normally causes an implicit flush() (at least for
all implementations of OutputStream I know and which do actually
implement flush()). So I see no need for an explicit flush(). Could you
please state which OutputStream implementation are used in your code?

On 12.03.2007 22:52:30 Jeff Vannest wrote:
> Will someone add "out.flush()" to the embedding example on the FOP
> website...for example, at
> http://xmlgraphics.apache.org/fop/0.93/embedding.html?
> 
> It seems a shame that everyone embedding FOP learns to flush() by trial and
> error.
> 
> Thanks!
> Jeff


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org