pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1652235 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Date Thu, 15 Jan 2015 19:13:31 GMT
Author: tilman
Date: Thu Jan 15 19:13:30 2015
New Revision: 1652235

URL: http://svn.apache.org/r1652235
Log:
PDFBOX-2576: simplify code with IOUtils

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1652235&r1=1652234&r2=1652235&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Thu Jan 15
19:13:30 2015
@@ -34,6 +34,7 @@ import org.apache.pdfbox.cos.COSInteger;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSObject;
 import org.apache.pdfbox.cos.COSStream;
+import org.apache.pdfbox.io.IOUtils;
 import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream;
 import org.apache.pdfbox.pdfparser.BaseParser;
 import org.apache.pdfbox.pdfparser.NonSequentialPDFParser;
@@ -476,14 +477,7 @@ public class PDDocument implements Close
                 dest.addCompression();
                 importedPage.setContents(dest);
                 os = dest.createOutputStream();
-
-                byte[] buf = new byte[10240];
-                int amountRead;
-                is = src.createInputStream();
-                while ((amountRead = is.read(buf, 0, 10240)) > -1)
-                {
-                    os.write(buf, 0, amountRead);
-                }
+                IOUtils.copy(is, os);
             }
             addPage(importedPage);
         }



Mime
View raw message