Author: tilman
Date: Wed Mar  7 17:46:43 2018
New Revision: 1826151

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

Modified:
    
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/COSFilterInputStream.java

Modified: 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/COSFilterInputStream.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/COSFilterInputStream.java?rev=1826151&r1=1826150&r2=1826151&view=diff
==============================================================================
--- 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/COSFilterInputStream.java
 (original)
+++ 
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/COSFilterInputStream.java
 Wed Mar  7 17:46:43 2018
@@ -17,10 +17,10 @@
 package org.apache.pdfbox.pdmodel.interactive.digitalsignature;
 
 import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import org.apache.pdfbox.io.IOUtils;
 
 
 public class COSFilterInputStream extends FilterInputStream
@@ -119,13 +119,6 @@ public class COSFilterInputStream extend
   
   public byte[] toByteArray() throws IOException 
   {
-    ByteArrayOutputStream byteOS = new ByteArrayOutputStream();
-    byte[] buffer = new byte[1024];
-    int c;
-    while ((c = this.read(buffer)) != -1)
-    {
-        byteOS.write(buffer, 0, c);
-    }
-    return byteOS.toByteArray();
+      return IOUtils.toByteArray(this);
   }
 }


Reply via email to