[ 
https://issues.apache.org/jira/browse/PDFBOX-3730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15938895#comment-15938895
 ] 

Tilman Hausherr commented on PDFBOX-3730:
-----------------------------------------

I added the buffering to save(File) in PDFBOX-3121 by user request. My thought 
at that time was to leave the save(InputStream) method untouched, for people 
who don't want buffering, e.g. to save space, or to write to a 
ByteArrayOutputStream.

How about treating your issue as a documentation wish? I.e. add a text to the 
javadoc like this: "This method does not do any buffering. If you need it, 
you'll have to wrap your outputStream into a BufferedOutputStream yourself."


> Encapsulate outputStream into BufferedOutputStream in PDDocument.save()
> -----------------------------------------------------------------------
>
>                 Key: PDFBOX-3730
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3730
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Writing
>    Affects Versions: 2.0.5
>            Reporter: Peter Pinnau
>            Priority: Minor
>
> I recognized very slow performance of PDDocument.save() with a 
> FileOutputStream over a VPN connection.
> I did some testing and found out that using PDDocument.save(File file) solved 
> the issue. So the BufferedInputStream makes the difference.
> Since my document API uses streams I encapsulate the OutputStream in a 
> BufferedOutputStream if neccessary:
> if (!(outputStream instanceof BufferedOutputStream)) {
>    outputStream = new BufferedOutputStream(outputStream);
> }
> pdDocument.save(outputStream);
> PDDocument.load() already does that with the InputStream. So I wonder if that 
> would be an improvement for save(), too?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to