pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1764739 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
Date Thu, 13 Oct 2016 17:09:43 GMT
Author: tilman
Date: Thu Oct 13 17:09:42 2016
New Revision: 1764739

URL: http://svn.apache.org/viewvc?rev=1764739&view=rev
Log:
PDFBOX-2852: simplify code

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java?rev=1764739&r1=1764738&r2=1764739&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
Thu Oct 13 17:09:42 2016
@@ -493,16 +493,11 @@ public class PDStream implements COSObje
     public byte[] toByteArray() throws IOException
     {
         ByteArrayOutputStream output = new ByteArrayOutputStream();
-        byte[] buf = new byte[1024];
         InputStream is = null;
         try
         {
             is = createInputStream();
-            int amountRead;
-            while ((amountRead = is.read(buf)) != -1)
-            {
-                output.write(buf, 0, amountRead);
-            }
+            IOUtils.copy(is, output);
         } 
         finally
         {



Mime
View raw message