pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1752875 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
Date Fri, 15 Jul 2016 19:49:25 GMT
Author: tilman
Date: Fri Jul 15 19:49:24 2016
New Revision: 1752875

URL: http://svn.apache.org/viewvc?rev=1752875&view=rev
Log:
PDFBOX-3017: DRY refactoring

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java?rev=1752875&r1=1752874&r2=1752875&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
Fri Jul 15 19:49:24 2016
@@ -79,10 +79,7 @@ public class SignatureOptions implements
      */
     public void setVisualSignature(File file) throws IOException
     {
-        pdfSource = new RandomAccessBufferedFileInputStream(file);
-        PDFParser parser = new PDFParser(pdfSource);
-        parser.parse();
-        visualSignature = parser.getDocument();
+        initFromRandomAccessRead(new RandomAccessBufferedFileInputStream(file));
     }
 
     /**
@@ -93,7 +90,12 @@ public class SignatureOptions implements
      */
     public void setVisualSignature(InputStream is) throws IOException
     {
-        pdfSource = new RandomAccessBuffer(is);
+        initFromRandomAccessRead(new RandomAccessBuffer(is));
+    }
+    
+    private void initFromRandomAccessRead(RandomAccessRead rar) throws IOException
+    {
+        pdfSource = rar;
         PDFParser parser = new PDFParser(pdfSource);
         parser.parse();
         visualSignature = parser.getDocument();



Mime
View raw message