Author: tboehme
Date: Sun Apr  8 15:02:52 2012
New Revision: 1311016

URL: http://svn.apache.org/viewvc?rev=1311016&view=rev
Log:
add 'isDecrypted' flag to COSDocument which signals that the document was 
already decrypted, needed e.g. by new NonSequentialPDFParser 

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java

Modified: 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
URL: 
http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java?rev=1311016&r1=1311015&r2=1311016&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java 
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java 
Sun Apr  8 15:02:52 2012
@@ -89,6 +89,9 @@ public class COSDocument extends COSBase
 
     private boolean warnMissingClose = true;
     
+    /** signal that document is already decrypted, e.g. with {@link 
NonSequentialPDFParser} */
+    private boolean isDecrypted = false;
+    
     private long startXref;
     
     private boolean closed = false;
@@ -309,6 +312,13 @@ public class COSDocument extends COSBase
         return version;
     }
 
+    /** Signals that the document is decrypted completely.
+     *  Needed e.g. by {@link NonSequentialPDFParser} to circumvent
+     *  additional decryption later on. */
+    public void setDecrypted() {
+               isDecrypted = true;
+    }
+    
     /**
      * This will tell if this is an encrypted document.
      *
@@ -316,6 +326,9 @@ public class COSDocument extends COSBase
      */
     public boolean isEncrypted()
     {
+                 if ( isDecrypted )
+                               return false;
+         
         boolean encrypted = false;
         if( trailer != null )
         {


Reply via email to