pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1858815 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
Date Mon, 06 May 2019 15:39:02 GMT
Author: tilman
Date: Mon May  6 15:39:01 2019
New Revision: 1858815

URL: http://svn.apache.org/viewvc?rev=1858815&view=rev
Log:
PDFBOX-4535: add convenience method to get a COSStream

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java?rev=1858815&r1=1858814&r2=1858815&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java Mon May  6
15:39:01 2019
@@ -644,6 +644,23 @@ public class COSDictionary extends COSBa
     }
 
     /**
+     * This is a convenience method that will get the dictionary object that is expected
to be a
+     * COSStream. Null is returned if the entry does not exist in the dictionary.
+     *
+     * @param key The key to the item in the dictionary.
+     * @return The COSStream.
+     */
+    public COSStream getCOSStream(COSName key)
+    {
+        COSBase base = getDictionaryObject(key);
+        if (base instanceof COSStream)
+        {
+            return (COSStream) base;
+        }
+        return null;
+    }
+
+    /**
      * This is a convenience method that will get the dictionary object that is expected
to be a COSArray. Null is
      * returned if the entry does not exist in the dictionary.
      *



Mime
View raw message