Class COSDictionary

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<COSName,​COSBase> items
      The name-value pairs of this dictionary.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.Object accept​(ICOSVisitor visitor)
      visitor pattern double dispatch method.
      void addAll​(COSDictionary dic)
      This will add all of the dictionarys keys/values to this dictionary.
      void clear()
      This will clear all items in the map.
      boolean containsKey​(java.lang.String name)  
      boolean containsKey​(COSName name)  
      boolean containsValue​(java.lang.Object value)  
      java.util.Set<java.util.Map.Entry<COSName,​COSBase>> entrySet()
      Returns the name-value entries in this dictionary.
      boolean getBoolean​(java.lang.String key, boolean defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a cos boolean and convert it to a primitive boolean.
      boolean getBoolean​(COSName key, boolean defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a COSBoolean and convert it to a primitive boolean.
      boolean getBoolean​(COSName firstKey, COSName secondKey, boolean defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a COSBoolean and convert it to a primitive boolean.
      java.util.Calendar getDate​(java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.util.Calendar getDate​(java.lang.String key, java.util.Calendar defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a date.
      java.util.Calendar getDate​(COSName key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.util.Calendar getDate​(COSName key, java.util.Calendar defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a date.
      COSBase getDictionaryObject​(java.lang.String key)
      This will get an object from this dictionary.
      COSBase getDictionaryObject​(java.lang.String[] keyList)
      This is a special case of getDictionaryObject that takes multiple keys, it will handle the situation where multiple keys could get the same value, ie if either CS or ColorSpace is used to get the colorspace.
      COSBase getDictionaryObject​(java.lang.String firstKey, java.lang.String secondKey)
      Deprecated.
      use getDictionaryObject(COSName, COSName) using COSName constants instead
      COSBase getDictionaryObject​(COSName key)
      This will get an object from this dictionary.
      COSBase getDictionaryObject​(COSName firstKey, COSName secondKey)
      This is a special case of getDictionaryObject that takes multiple keys, it will handle the situation where multiple keys could get the same value, ie if either CS or ColorSpace is used to get the colorspace.
      java.util.Calendar getEmbeddedDate​(java.lang.String embedded, java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.util.Calendar getEmbeddedDate​(java.lang.String embedded, java.lang.String key, java.util.Calendar defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a date.
      java.util.Calendar getEmbeddedDate​(java.lang.String embedded, COSName key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.util.Calendar getEmbeddedDate​(java.lang.String embedded, COSName key, java.util.Calendar defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a date.
      int getEmbeddedInt​(java.lang.String embeddedDictionary, java.lang.String key)
      Get an integer from an embedded dictionary.
      int getEmbeddedInt​(java.lang.String embeddedDictionary, java.lang.String key, int defaultValue)
      Get an integer from an embedded dictionary.
      int getEmbeddedInt​(java.lang.String embeddedDictionary, COSName key)
      Get an integer from an embedded dictionary.
      int getEmbeddedInt​(java.lang.String embeddedDictionary, COSName key, int defaultValue)
      Get an integer from an embedded dictionary.
      java.lang.String getEmbeddedString​(java.lang.String embedded, java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getEmbeddedString​(java.lang.String embedded, java.lang.String key, java.lang.String defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getEmbeddedString​(java.lang.String embedded, COSName key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getEmbeddedString​(java.lang.String embedded, COSName key, java.lang.String defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      float getFloat​(java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be an float. -1 is returned if there is no value.
      float getFloat​(java.lang.String key, float defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a float.
      float getFloat​(COSName key)
      This is a convenience method that will get the dictionary object that is expected to be an float. -1 is returned if there is no value.
      float getFloat​(COSName key, float defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an float.
      int getInt​(java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be an int. -1 is returned if there is no value.
      int getInt​(java.lang.String[] keyList, int defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an integer.
      int getInt​(java.lang.String key, int defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an integer.
      int getInt​(COSName key)
      This is a convenience method that will get the dictionary object that is expected to be an int. -1 is returned if there is no value.
      int getInt​(COSName key, int defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an integer.
      int getInt​(COSName firstKey, COSName secondKey)
      This is a convenience method that will get the dictionary object that is expected to be an integer.
      int getInt​(COSName firstKey, COSName secondKey, int defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an integer.
      COSBase getItem​(java.lang.String key)
      This will do a lookup into the dictionary.
      COSBase getItem​(COSName key)
      This will do a lookup into the dictionary.
      COSName getKeyForValue​(java.lang.Object value)
      Search in the map for the value that matches the parameter and return the first key that maps to that value.
      long getLong​(java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be an long. -1 is returned if there is no value.
      long getLong​(java.lang.String[] keyList, long defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an long.
      long getLong​(java.lang.String key, long defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an integer.
      long getLong​(COSName key)
      This is a convenience method that will get the dictionary object that is expected to be an long. -1 is returned if there is no value.
      long getLong​(COSName key, long defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be an integer.
      java.lang.String getNameAsString​(java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getNameAsString​(java.lang.String key, java.lang.String defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getNameAsString​(COSName key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getNameAsString​(COSName key, java.lang.String defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      COSBase getObjectFromPath​(java.lang.String objPath)
      Nice method, gives you every object you want Arrays works properly too.
      java.lang.String getString​(java.lang.String key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getString​(java.lang.String key, java.lang.String defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getString​(COSName key)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.lang.String getString​(COSName key, java.lang.String defaultValue)
      This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      java.util.Collection<COSBase> getValues()
      This will get all of the values for the dictionary.
      java.util.List<COSName> keyList()
      Deprecated.
      Use the entrySet() method instead.
      java.util.Set<COSName> keySet()
      Returns the names of the entries in this dictionary.
      void mergeInto​(COSDictionary dic)
      This will add all of the dictionarys keys/values to this dictionary, but only if they don't already exist.
      void removeItem​(COSName key)
      This will remove an item for the dictionary.
      void setBoolean​(java.lang.String key, boolean value)
      This will set an item in the dictionary.
      void setBoolean​(COSName key, boolean value)
      This will set an item in the dictionary.
      void setDate​(java.lang.String key, java.util.Calendar date)
      Set the value of a date entry in the dictionary.
      void setDate​(COSName key, java.util.Calendar date)
      Set the date object.
      void setEmbeddedDate​(java.lang.String embedded, java.lang.String key, java.util.Calendar date)
      Set the value of a date entry in the dictionary.
      void setEmbeddedDate​(java.lang.String embedded, COSName key, java.util.Calendar date)
      Set the date object.
      void setEmbeddedInt​(java.lang.String embeddedDictionary, java.lang.String key, int value)
      This is a convenience method that will convert the value to a COSInteger object.
      void setEmbeddedInt​(java.lang.String embeddedDictionary, COSName key, int value)
      This is a convenience method that will convert the value to a COSInteger object.
      void setEmbeddedString​(java.lang.String embedded, java.lang.String key, java.lang.String value)
      This is a convenience method that will convert the value to a COSString object.
      void setEmbeddedString​(java.lang.String embedded, COSName key, java.lang.String value)
      This is a convenience method that will convert the value to a COSString object.
      void setFloat​(java.lang.String key, float value)
      This is a convenience method that will convert the value to a COSFloat object.
      void setFloat​(COSName key, float value)
      This is a convenience method that will convert the value to a COSFloat object.
      void setInt​(java.lang.String key, int value)
      This is a convenience method that will convert the value to a COSInteger object.
      void setInt​(COSName key, int value)
      This is a convenience method that will convert the value to a COSInteger object.
      void setItem​(java.lang.String key, COSBase value)
      This will set an item in the dictionary.
      void setItem​(java.lang.String key, COSObjectable value)
      This will set an item in the dictionary.
      void setItem​(COSName key, COSBase value)
      This will set an item in the dictionary.
      void setItem​(COSName key, COSObjectable value)
      This will set an item in the dictionary.
      void setLong​(java.lang.String key, long value)
      This is a convenience method that will convert the value to a COSInteger object.
      void setLong​(COSName key, long value)
      This is a convenience method that will convert the value to a COSInteger object.
      void setName​(java.lang.String key, java.lang.String value)
      This is a convenience method that will convert the value to a COSName object.
      void setName​(COSName key, java.lang.String value)
      This is a convenience method that will convert the value to a COSName object.
      void setString​(java.lang.String key, java.lang.String value)
      This is a convenience method that will convert the value to a COSString object.
      void setString​(COSName key, java.lang.String value)
      This is a convenience method that will convert the value to a COSString object.
      int size()
      This will return the number of elements in this dictionary.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • items

        protected final java.util.Map<COSName,​COSBase> items
        The name-value pairs of this dictionary. The pairs are kept in the order they were added to the dictionary.
    • Constructor Detail

      • COSDictionary

        public COSDictionary()
        Constructor.
      • COSDictionary

        public COSDictionary​(COSDictionary dict)
        Copy Constructor. This will make a shallow copy of this dictionary.
        Parameters:
        dict - The dictionary to copy.
    • Method Detail

      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Parameters:
        value - The value to find in the map.
        Returns:
        true if the map contains this value.
        See Also:
        Map.containsValue(java.lang.Object)
      • getKeyForValue

        public COSName getKeyForValue​(java.lang.Object value)
        Search in the map for the value that matches the parameter and return the first key that maps to that value.
        Parameters:
        value - The value to search for in the map.
        Returns:
        The key for the value in the map or null if it does not exist.
      • size

        public int size()
        This will return the number of elements in this dictionary.
        Returns:
        The number of elements in the dictionary.
      • clear

        public void clear()
        This will clear all items in the map.
      • getDictionaryObject

        public COSBase getDictionaryObject​(java.lang.String key)
        This will get an object from this dictionary. If the object is a reference then it will dereference it and get it from the document. If the object is COSNull then null will be returned.
        Parameters:
        key - The key to the object that we are getting.
        Returns:
        The object that matches the key.
      • getDictionaryObject

        public COSBase getDictionaryObject​(java.lang.String firstKey,
                                           java.lang.String secondKey)
        Deprecated.
        use getDictionaryObject(COSName, COSName) using COSName constants instead
        This is a special case of getDictionaryObject that takes multiple keys, it will handle the situation where multiple keys could get the same value, ie if either CS or ColorSpace is used to get the colorspace. This will get an object from this dictionary. If the object is a reference then it will dereference it and get it from the document. If the object is COSNull then null will be returned.
        Parameters:
        firstKey - The first key to try.
        secondKey - The second key to try.
        Returns:
        The object that matches the key.
      • getDictionaryObject

        public COSBase getDictionaryObject​(COSName firstKey,
                                           COSName secondKey)
        This is a special case of getDictionaryObject that takes multiple keys, it will handle the situation where multiple keys could get the same value, ie if either CS or ColorSpace is used to get the colorspace. This will get an object from this dictionary. If the object is a reference then it will dereference it and get it from the document. If the object is COSNull then null will be returned.
        Parameters:
        firstKey - The first key to try.
        secondKey - The second key to try.
        Returns:
        The object that matches the key.
      • getDictionaryObject

        public COSBase getDictionaryObject​(java.lang.String[] keyList)
        This is a special case of getDictionaryObject that takes multiple keys, it will handle the situation where multiple keys could get the same value, ie if either CS or ColorSpace is used to get the colorspace. This will get an object from this dictionary. If the object is a reference then it will dereference it and get it from the document. If the object is COSNull then null will be returned.
        Parameters:
        keyList - The list of keys to find a value.
        Returns:
        The object that matches the key.
      • getDictionaryObject

        public COSBase getDictionaryObject​(COSName key)
        This will get an object from this dictionary. If the object is a reference then it will dereference it and get it from the document. If the object is COSNull then null will be returned.
        Parameters:
        key - The key to the object that we are getting.
        Returns:
        The object that matches the key.
      • setItem

        public void setItem​(COSName key,
                            COSBase value)
        This will set an item in the dictionary. If value is null then the result will be the same as removeItem( key ).
        Parameters:
        key - The key to the dictionary object.
        value - The value to the dictionary object.
      • setItem

        public void setItem​(COSName key,
                            COSObjectable value)
        This will set an item in the dictionary. If value is null then the result will be the same as removeItem( key ).
        Parameters:
        key - The key to the dictionary object.
        value - The value to the dictionary object.
      • setItem

        public void setItem​(java.lang.String key,
                            COSObjectable value)
        This will set an item in the dictionary. If value is null then the result will be the same as removeItem( key ).
        Parameters:
        key - The key to the dictionary object.
        value - The value to the dictionary object.
      • setBoolean

        public void setBoolean​(java.lang.String key,
                               boolean value)
        This will set an item in the dictionary.
        Parameters:
        key - The key to the dictionary object.
        value - The value to the dictionary object.
      • setBoolean

        public void setBoolean​(COSName key,
                               boolean value)
        This will set an item in the dictionary.
        Parameters:
        key - The key to the dictionary object.
        value - The value to the dictionary object.
      • setItem

        public void setItem​(java.lang.String key,
                            COSBase value)
        This will set an item in the dictionary. If value is null then the result will be the same as removeItem( key ).
        Parameters:
        key - The key to the dictionary object.
        value - The value to the dictionary object.
      • setName

        public void setName​(java.lang.String key,
                            java.lang.String value)
        This is a convenience method that will convert the value to a COSName object. If it is null then the object will be removed.
        Parameters:
        key - The key to the object,
        value - The string value for the name.
      • setName

        public void setName​(COSName key,
                            java.lang.String value)
        This is a convenience method that will convert the value to a COSName object. If it is null then the object will be removed.
        Parameters:
        key - The key to the object,
        value - The string value for the name.
      • setDate

        public void setDate​(java.lang.String key,
                            java.util.Calendar date)
        Set the value of a date entry in the dictionary.
        Parameters:
        key - The key to the date value.
        date - The date value.
      • setDate

        public void setDate​(COSName key,
                            java.util.Calendar date)
        Set the date object.
        Parameters:
        key - The key to the date.
        date - The date to set.
      • setEmbeddedDate

        public void setEmbeddedDate​(java.lang.String embedded,
                                    java.lang.String key,
                                    java.util.Calendar date)
        Set the value of a date entry in the dictionary.
        Parameters:
        embedded - The embedded dictionary.
        key - The key to the date value.
        date - The date value.
      • setEmbeddedDate

        public void setEmbeddedDate​(java.lang.String embedded,
                                    COSName key,
                                    java.util.Calendar date)
        Set the date object.
        Parameters:
        embedded - The embedded dictionary.
        key - The key to the date.
        date - The date to set.
      • setString

        public void setString​(java.lang.String key,
                              java.lang.String value)
        This is a convenience method that will convert the value to a COSString object. If it is null then the object will be removed.
        Parameters:
        key - The key to the object,
        value - The string value for the name.
      • setString

        public void setString​(COSName key,
                              java.lang.String value)
        This is a convenience method that will convert the value to a COSString object. If it is null then the object will be removed.
        Parameters:
        key - The key to the object,
        value - The string value for the name.
      • setEmbeddedString

        public void setEmbeddedString​(java.lang.String embedded,
                                      java.lang.String key,
                                      java.lang.String value)
        This is a convenience method that will convert the value to a COSString object. If it is null then the object will be removed.
        Parameters:
        embedded - The embedded dictionary to set the item in.
        key - The key to the object,
        value - The string value for the name.
      • setEmbeddedString

        public void setEmbeddedString​(java.lang.String embedded,
                                      COSName key,
                                      java.lang.String value)
        This is a convenience method that will convert the value to a COSString object. If it is null then the object will be removed.
        Parameters:
        embedded - The embedded dictionary to set the item in.
        key - The key to the object,
        value - The string value for the name.
      • setInt

        public void setInt​(java.lang.String key,
                           int value)
        This is a convenience method that will convert the value to a COSInteger object.
        Parameters:
        key - The key to the object,
        value - The int value for the name.
      • setInt

        public void setInt​(COSName key,
                           int value)
        This is a convenience method that will convert the value to a COSInteger object.
        Parameters:
        key - The key to the object,
        value - The int value for the name.
      • setLong

        public void setLong​(java.lang.String key,
                            long value)
        This is a convenience method that will convert the value to a COSInteger object.
        Parameters:
        key - The key to the object,
        value - The int value for the name.
      • setLong

        public void setLong​(COSName key,
                            long value)
        This is a convenience method that will convert the value to a COSInteger object.
        Parameters:
        key - The key to the object,
        value - The int value for the name.
      • setEmbeddedInt

        public void setEmbeddedInt​(java.lang.String embeddedDictionary,
                                   java.lang.String key,
                                   int value)
        This is a convenience method that will convert the value to a COSInteger object.
        Parameters:
        embeddedDictionary - The embedded dictionary.
        key - The key to the object,
        value - The int value for the name.
      • setEmbeddedInt

        public void setEmbeddedInt​(java.lang.String embeddedDictionary,
                                   COSName key,
                                   int value)
        This is a convenience method that will convert the value to a COSInteger object.
        Parameters:
        embeddedDictionary - The embedded dictionary.
        key - The key to the object,
        value - The int value for the name.
      • setFloat

        public void setFloat​(java.lang.String key,
                             float value)
        This is a convenience method that will convert the value to a COSFloat object.
        Parameters:
        key - The key to the object,
        value - The int value for the name.
      • setFloat

        public void setFloat​(COSName key,
                             float value)
        This is a convenience method that will convert the value to a COSFloat object.
        Parameters:
        key - The key to the object,
        value - The int value for the name.
      • getNameAsString

        public java.lang.String getNameAsString​(java.lang.String key)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
      • getNameAsString

        public java.lang.String getNameAsString​(COSName key)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
      • getNameAsString

        public java.lang.String getNameAsString​(java.lang.String key,
                                                java.lang.String defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The name converted to a string.
      • getNameAsString

        public java.lang.String getNameAsString​(COSName key,
                                                java.lang.String defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The name converted to a string.
      • getString

        public java.lang.String getString​(java.lang.String key)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
      • getString

        public java.lang.String getString​(COSName key)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.String defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
      • getString

        public java.lang.String getString​(COSName key,
                                          java.lang.String defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
      • getEmbeddedString

        public java.lang.String getEmbeddedString​(java.lang.String embedded,
                                                  java.lang.String key)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary.
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
      • getEmbeddedString

        public java.lang.String getEmbeddedString​(java.lang.String embedded,
                                                  COSName key)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary.
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
      • getEmbeddedString

        public java.lang.String getEmbeddedString​(java.lang.String embedded,
                                                  java.lang.String key,
                                                  java.lang.String defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary.
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
      • getEmbeddedString

        public java.lang.String getEmbeddedString​(java.lang.String embedded,
                                                  COSName key,
                                                  java.lang.String defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary.
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
      • getDate

        public java.util.Calendar getDate​(java.lang.String key)
                                   throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getDate

        public java.util.Calendar getDate​(COSName key)
                                   throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getDate

        public java.util.Calendar getDate​(java.lang.String key,
                                          java.util.Calendar defaultValue)
                                   throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a date. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getDate

        public java.util.Calendar getDate​(COSName key,
                                          java.util.Calendar defaultValue)
                                   throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a date. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getEmbeddedDate

        public java.util.Calendar getEmbeddedDate​(java.lang.String embedded,
                                                  java.lang.String key)
                                           throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary to get.
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getEmbeddedDate

        public java.util.Calendar getEmbeddedDate​(java.lang.String embedded,
                                                  COSName key)
                                           throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a name and convert it to a string. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary to get.
        key - The key to the item in the dictionary.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getEmbeddedDate

        public java.util.Calendar getEmbeddedDate​(java.lang.String embedded,
                                                  java.lang.String key,
                                                  java.util.Calendar defaultValue)
                                           throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a date. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary to get.
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getEmbeddedDate

        public java.util.Calendar getEmbeddedDate​(java.lang.String embedded,
                                                  COSName key,
                                                  java.util.Calendar defaultValue)
                                           throws java.io.IOException
        This is a convenience method that will get the dictionary object that is expected to be a date. Null is returned if the entry does not exist in the dictionary.
        Parameters:
        embedded - The embedded dictionary to get.
        key - The key to the item in the dictionary.
        defaultValue - The default value to return.
        Returns:
        The name converted to a string.
        Throws:
        java.io.IOException - If there is an error converting to a date.
      • getBoolean

        public boolean getBoolean​(java.lang.String key,
                                  boolean defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a cos boolean and convert it to a primitive boolean.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value returned if the entry is null.
        Returns:
        The value converted to a boolean.
      • getBoolean

        public boolean getBoolean​(COSName key,
                                  boolean defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a COSBoolean and convert it to a primitive boolean.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value returned if the entry is null.
        Returns:
        The entry converted to a boolean.
      • getBoolean

        public boolean getBoolean​(COSName firstKey,
                                  COSName secondKey,
                                  boolean defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a COSBoolean and convert it to a primitive boolean.
        Parameters:
        firstKey - The first key to the item in the dictionary.
        secondKey - The second key to the item in the dictionary.
        defaultValue - The value returned if the entry is null.
        Returns:
        The entry converted to a boolean.
      • getEmbeddedInt

        public int getEmbeddedInt​(java.lang.String embeddedDictionary,
                                  java.lang.String key)
        Get an integer from an embedded dictionary. Useful for 1-1 mappings. default:-1
        Parameters:
        embeddedDictionary - The name of the embedded dictionary.
        key - The key in the embedded dictionary.
        Returns:
        The value of the embedded integer.
      • getEmbeddedInt

        public int getEmbeddedInt​(java.lang.String embeddedDictionary,
                                  COSName key)
        Get an integer from an embedded dictionary. Useful for 1-1 mappings. default:-1
        Parameters:
        embeddedDictionary - The name of the embedded dictionary.
        key - The key in the embedded dictionary.
        Returns:
        The value of the embedded integer.
      • getEmbeddedInt

        public int getEmbeddedInt​(java.lang.String embeddedDictionary,
                                  java.lang.String key,
                                  int defaultValue)
        Get an integer from an embedded dictionary. Useful for 1-1 mappings.
        Parameters:
        embeddedDictionary - The name of the embedded dictionary.
        key - The key in the embedded dictionary.
        defaultValue - The value if there is no embedded dictionary or it does not contain the key.
        Returns:
        The value of the embedded integer.
      • getEmbeddedInt

        public int getEmbeddedInt​(java.lang.String embeddedDictionary,
                                  COSName key,
                                  int defaultValue)
        Get an integer from an embedded dictionary. Useful for 1-1 mappings.
        Parameters:
        embeddedDictionary - The name of the embedded dictionary.
        key - The key in the embedded dictionary.
        defaultValue - The value if there is no embedded dictionary or it does not contain the key.
        Returns:
        The value of the embedded integer.
      • getInt

        public int getInt​(java.lang.String key)
        This is a convenience method that will get the dictionary object that is expected to be an int. -1 is returned if there is no value.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The integer value.
      • getInt

        public int getInt​(COSName key)
        This is a convenience method that will get the dictionary object that is expected to be an int. -1 is returned if there is no value.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The integer value..
      • getInt

        public int getInt​(java.lang.String[] keyList,
                          int defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an integer. If the dictionary value is null then the default Value will be returned.
        Parameters:
        keyList - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The integer value.
      • getInt

        public int getInt​(java.lang.String key,
                          int defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an integer. If the dictionary value is null then the default Value will be returned.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The integer value.
      • getInt

        public int getInt​(COSName key,
                          int defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an integer. If the dictionary value is null then the default Value will be returned.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The integer value.
      • getInt

        public int getInt​(COSName firstKey,
                          COSName secondKey)
        This is a convenience method that will get the dictionary object that is expected to be an integer. If the dictionary value is null then the default Value -1 will be returned.
        Parameters:
        firstKey - The first key to the item in the dictionary.
        secondKey - The second key to the item in the dictionary.
        Returns:
        The integer value.
      • getInt

        public int getInt​(COSName firstKey,
                          COSName secondKey,
                          int defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an integer. If the dictionary value is null then the default Value will be returned.
        Parameters:
        firstKey - The first key to the item in the dictionary.
        secondKey - The second key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The integer value.
      • getLong

        public long getLong​(java.lang.String key)
        This is a convenience method that will get the dictionary object that is expected to be an long. -1 is returned if there is no value.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The long value.
      • getLong

        public long getLong​(COSName key)
        This is a convenience method that will get the dictionary object that is expected to be an long. -1 is returned if there is no value.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The long value.
      • getLong

        public long getLong​(java.lang.String[] keyList,
                            long defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an long. If the dictionary value is null then the default Value will be returned.
        Parameters:
        keyList - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The long value.
      • getLong

        public long getLong​(java.lang.String key,
                            long defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an integer. If the dictionary value is null then the default Value will be returned.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The integer value.
      • getLong

        public long getLong​(COSName key,
                            long defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an integer. If the dictionary value is null then the default Value will be returned.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The integer value.
      • getFloat

        public float getFloat​(java.lang.String key)
        This is a convenience method that will get the dictionary object that is expected to be an float. -1 is returned if there is no value.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The float value.
      • getFloat

        public float getFloat​(COSName key)
        This is a convenience method that will get the dictionary object that is expected to be an float. -1 is returned if there is no value.
        Parameters:
        key - The key to the item in the dictionary.
        Returns:
        The float value.
      • getFloat

        public float getFloat​(java.lang.String key,
                              float defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be a float. If the dictionary value is null then the default Value will be returned.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The float value.
      • getFloat

        public float getFloat​(COSName key,
                              float defaultValue)
        This is a convenience method that will get the dictionary object that is expected to be an float. If the dictionary value is null then the default Value will be returned.
        Parameters:
        key - The key to the item in the dictionary.
        defaultValue - The value to return if the dictionary item is null.
        Returns:
        The float value.
      • removeItem

        public void removeItem​(COSName key)
        This will remove an item for the dictionary. This will do nothing of the object does not exist.
        Parameters:
        key - The key to the item to remove from the dictionary.
      • getItem

        public COSBase getItem​(COSName key)
        This will do a lookup into the dictionary.
        Parameters:
        key - The key to the object.
        Returns:
        The item that matches the key.
      • getItem

        public COSBase getItem​(java.lang.String key)
        This will do a lookup into the dictionary.
        Parameters:
        key - The key to the object.
        Returns:
        The item that matches the key.
      • keyList

        public java.util.List<COSName> keyList()
        Deprecated.
        Use the entrySet() method instead.
        This will get the keys for all objects in the dictionary in the sequence that they were added.
        Returns:
        a list of the keys in the sequence of insertion
      • keySet

        public java.util.Set<COSName> keySet()
        Returns the names of the entries in this dictionary. The returned set is in the order the entries were added to the dictionary.
        Returns:
        names of the entries in this dictionary
        Since:
        Apache PDFBox 1.1.0
      • entrySet

        public java.util.Set<java.util.Map.Entry<COSName,​COSBase>> entrySet()
        Returns the name-value entries in this dictionary. The returned set is in the order the entries were added to the dictionary.
        Returns:
        name-value entries in this dictionary
        Since:
        Apache PDFBox 1.1.0
      • getValues

        public java.util.Collection<COSBase> getValues()
        This will get all of the values for the dictionary.
        Returns:
        All the values for the dictionary.
      • accept

        public java.lang.Object accept​(ICOSVisitor visitor)
                                throws COSVisitorException
        visitor pattern double dispatch method.
        Specified by:
        accept in class COSBase
        Parameters:
        visitor - The object to notify when visiting this object.
        Returns:
        The object that the visitor returns.
        Throws:
        COSVisitorException - If there is an error visiting this object.
      • addAll

        public void addAll​(COSDictionary dic)
        This will add all of the dictionarys keys/values to this dictionary. Only called when adding keys to a trailer that already exists.
        Parameters:
        dic - The dic to get the keys from.
      • containsKey

        public boolean containsKey​(COSName name)
        Parameters:
        name - The key to find in the map.
        Returns:
        true if the map contains this key.
        See Also:
        Map.containsKey(Object)
      • containsKey

        public boolean containsKey​(java.lang.String name)
        Parameters:
        name - The key to find in the map.
        Returns:
        true if the map contains this key.
        See Also:
        Map.containsKey(Object)
      • mergeInto

        public void mergeInto​(COSDictionary dic)
        This will add all of the dictionarys keys/values to this dictionary, but only if they don't already exist. If a key already exists in this dictionary then nothing is changed.
        Parameters:
        dic - The dic to get the keys from.
      • getObjectFromPath

        public COSBase getObjectFromPath​(java.lang.String objPath)
        Nice method, gives you every object you want Arrays works properly too. Try "P/Annots/[k]/Rect" where k means the index of the Annotsarray.
        Parameters:
        objPath - the relative path to the object.
        Returns:
        the object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object