Author: tilman
Date: Thu Oct 13 17:09:37 2016
New Revision: 1764738

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

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

Modified: 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
URL: 
http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java?rev=1764738&r1=1764737&r2=1764738&view=diff
==============================================================================
--- 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
 (original)
+++ 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java
 Thu Oct 13 17:09:37 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
         {


Reply via email to