You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/10/13 21:33:47 UTC
svn commit: r1631526 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Author: tilman
Date: Mon Oct 13 19:33:46 2014
New Revision: 1631526
URL: http://svn.apache.org/r1631526
Log:
PDFBOX-1798: performance optimization, as suggested by Dmytro Karimov
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1631526&r1=1631525&r2=1631526&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Mon Oct 13 19:33:46 2014
@@ -21,6 +21,8 @@ import java.awt.print.Pageable;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
@@ -1364,7 +1366,8 @@ public class PDDocument implements Pagea
*/
public void saveIncremental( String fileName ) throws IOException, COSVisitorException
{
- saveIncremental( new FileInputStream( fileName ) , new FileOutputStream( fileName , true) );
+ saveIncremental(new BufferedInputStream(new FileInputStream(fileName)),
+ new BufferedOutputStream(new FileOutputStream(fileName, true)));
}
/**
@@ -1375,7 +1378,7 @@ public class PDDocument implements Pagea
* @throws IOException if something went wrong
* @throws COSVisitorException if something went wrong
*/
- public void saveIncremental( FileInputStream input, OutputStream output ) throws IOException, COSVisitorException
+ public void saveIncremental(InputStream input, OutputStream output) throws IOException, COSVisitorException
{
//update the count in case any pages have been added behind the scenes.
getDocumentCatalog().getPages().updateCount();