Class COSDictionary

java.lang.Object
org.sejda.sambox.cos.COSBase
org.sejda.sambox.cos.COSDictionary
All Implemented Interfaces:
COSObjectable
Direct Known Subclasses:
COSStream

public class COSDictionary extends COSBase
This class represents a dictionary where name/value pairs reside.
Author:
Ben Litchfield
  • Field Details

    • items

      protected 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 Details

    • COSDictionary

      public COSDictionary()
    • COSDictionary

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

    • getKeyForValue

      public COSName getKeyForValue(COSBase 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()
      Returns:
      The number of elements in the dictionary.
    • clear

      public void clear()
    • getDictionaryObject

      public COSBase getDictionaryObject(String key)
      This will get an object from this dictionary. If the object is a reference then it will dereference it. 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 <T extends COSBase> T getDictionaryObject(String key, Class<T> clazz)
      Get an object of the expected type from this dictionary. If the type is not compatible, null is returned
      Parameters:
      key -
      clazz -
      Returns:
      The object that matches the key and the type or null.
    • 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 <T extends COSBase> T getDictionaryObject(COSName firstKey, COSName secondKey, Class<T> clazz)
      Parameters:
      firstKey -
      secondKey -
      clazz -
      Returns:
      See Also:
    • getDictionaryObject

      public COSBase getDictionaryObject(COSName key)
      Get an object from this dictionary. If the object is a reference then it will dereference it. 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 or null.
    • getDictionaryObject

      public <T extends COSBase> T getDictionaryObject(COSName key, Class<T> clazz)
      Get an object of the expected type from this dictionary. If the type is not compatible, null is returned
      Parameters:
      key -
      clazz -
      Returns:
      The object that matches the key and the type or null.
    • setItem

      public void setItem(COSName key, COSBase value)
      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.
    • putIfAbsent

      public void putIfAbsent(COSName key, COSBase value)
    • setItem

      public void setItem(COSName key, COSObjectable value)
      Set the wrapped COSBase as 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.
    • putIfAbsent

      public void putIfAbsent(COSName key, COSObjectable value)
    • setItem

      public void setItem(String key, COSObjectable value)
      Set the wrapped COSBase as 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(String key, boolean value)
      Set a boolean 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)
      Set a boolean item in the dictionary.
      Parameters:
      key - The key to the dictionary object.
      value - The value to the dictionary object.
    • putIfAbsent

      public void putIfAbsent(COSName key, boolean value)
    • setItem

      public void setItem(String key, COSBase value)
      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(String key, String value)
      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, String value)
      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(String key, 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, Calendar date)
      Set the date object.
      Parameters:
      key - The key to the date.
      date - The date to set.
    • setEmbeddedDate

      public void setEmbeddedDate(String embedded, String key, 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(String embedded, COSName key, 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(String key, String value)
      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, String value)
      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.
    • putIfAbsent

      public void putIfAbsent(COSName key, String value)
    • setEmbeddedString

      public void setEmbeddedString(String embedded, String key, String value)
      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(String embedded, COSName key, String value)
      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(String key, int value)
      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)
      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.
    • putIfAbsent

      public void putIfAbsent(COSName key, int value)
    • setLong

      public void setLong(String key, long value)
      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)
      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.
    • putIfAbsent

      public void putIfAbsent(COSName key, long value)
    • setEmbeddedInt

      public void setEmbeddedInt(String embeddedDictionary, String key, long value)
      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(String embeddedDictionary, COSName key, long value)
      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(String key, float value)
      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)
      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.
    • setFlag

      public void setFlag(COSName field, int bitFlag, boolean value)
      Sets the given boolean value at bitPos in the flags.
      Parameters:
      field - The COSName of the field to set the value into.
      bitFlag - the bit position to set the value in.
      value - the value the bit position should have.
    • getCOSName

      public COSName getCOSName(COSName key)
      Convenience method that will get the dictionary object that is expected to be a name. Null is returned if the entry does not exist in the dictionary.
      Parameters:
      key - The key to the item in the dictionary.
      Returns:
      The COS name.
    • getCOSArray

      public COSArray getCOSArray(COSName key)
      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.
      Parameters:
      key - The key to the item in the dictionary.
      Returns:
      The COSArray.
    • getCOSName

      public COSName getCOSName(COSName key, COSName defaultValue)
      Convenience method that will get the dictionary object that is expected to be a name. Default 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 COS name.
    • getNameAsString

      public String getNameAsString(String key)
      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 String getNameAsString(COSName key)
      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 String getNameAsString(String key, String defaultValue)
      Convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      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 String getNameAsString(COSName key, String defaultValue)
      Convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      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 String getString(String key)
      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 String getString(COSName key)
      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 String getString(String key, String defaultValue)
      Convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      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 String getString(COSName key, String defaultValue)
      Convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      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 String getEmbeddedString(String embedded, String key)
      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 String getEmbeddedString(String embedded, COSName key)
      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 String getEmbeddedString(String embedded, String key, String defaultValue)
      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 String getEmbeddedString(String embedded, COSName key, String defaultValue)
      Convenience method that will get the dictionary object that is expected to be a name and convert it to a string.
      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 Calendar getDate(String key)
      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 or if the date was invalid.
      Parameters:
      key - The key to the item in the dictionary.
      Returns:
      The name converted to a date.
    • getDate

      public Calendar getDate(COSName key)
      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 or if the date was invalid.
      Parameters:
      key - The key to the item in the dictionary.
      Returns:
      The name converted to a date.
    • getDate

      public Calendar getDate(String key, Calendar defaultValue)
      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 or if the date was invalid.
      Parameters:
      key - The key to the item in the dictionary.
      defaultValue - The default value to return.
      Returns:
      The name converted to a date.
    • getDate

      public Calendar getDate(COSName key, Calendar defaultValue)
      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 or if the date was invalid.
      Parameters:
      key - The key to the item in the dictionary.
      defaultValue - The default value to return.
      Returns:
      The name converted to a date.
    • getEmbeddedDate

      public Calendar getEmbeddedDate(String embedded, String key)
      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.
    • getEmbeddedDate

      public Calendar getEmbeddedDate(String embedded, COSName key)
      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.
    • getEmbeddedDate

      public Calendar getEmbeddedDate(String embedded, String key, Calendar defaultValue)
      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.
    • getEmbeddedDate

      public Calendar getEmbeddedDate(String embedded, COSName key, Calendar defaultValue)
      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.
    • getBoolean

      public boolean getBoolean(String key, boolean defaultValue)
      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)
      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)
      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(String embeddedDictionary, 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(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(String embeddedDictionary, 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(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(String key)
      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)
      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(String key, int defaultValue)
      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)
      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)
      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)
      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(String key)
      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)
      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(String key, long defaultValue)
      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)
      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(String key)
      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)
      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(String key, float defaultValue)
      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)
      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.
    • getFlag

      public boolean getFlag(COSName field, int bitFlag)
      Gets the boolean value from the flags at the given bit position.
      Parameters:
      field - The COSName of the field to get the flag from.
      bitFlag - the bitPosition to get the value from.
      Returns:
      true if the number at bitPos is '1'
    • removeItem

      public void removeItem(COSName key)
      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.
    • removeItems

      public void removeItems(COSName... keys)
      Remove the items for the dictionary. This will do nothing of the object does not exist.
      Parameters:
      keys - The keys to the item to remove from the dictionary.
    • getItem

      public COSBase getItem(COSName key)
      Parameters:
      key - The key to the object.
      Returns:
      The item that matches the key.
    • getItem

      public COSBase getItem(String key)
      Parameters:
      key - The key to the object.
      Returns:
      The item that matches the key.
    • getItem

      public COSBase getItem(COSName firstKey, COSName secondKey)
      This is a special case of getItem 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.
      Parameters:
      firstKey - The first key to try.
      secondKey - The second key to try.
      Returns:
      The object that matches the key.
    • keySet

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

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

      public Collection<COSBase> getValues()
      Returns:
      All the values for the dictionary.
    • accept

      public void accept(COSVisitor visitor) throws IOException
      Description copied from class: COSBase
      Visitor pattern for the COS model objects
      Specified by:
      accept in class COSBase
      Throws:
      IOException
    • addAll

      public void addAll(COSDictionary dic)
      This will add all of the dictionaries keys/values to this dictionary.
      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:
    • containsKey

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

      public void mergeWithoutOverwriting(COSDictionary dic)
      Adds all of the dictionaries 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 COSDictionary to get the keys from.
    • merge

      public void merge(COSDictionary dic)
      Adds all of the dictionaries keys/values to this dictionary. If a key already exists in this dictionary the value is overridden.
      Parameters:
      dic - The COSDictionary to get the keys from.
    • asUnmodifiableDictionary

      public COSDictionary asUnmodifiableDictionary()
      Returns:
      an unmodifiable view of this dictionary
    • duplicate

      public COSDictionary duplicate()
      Returns:
      a new COSDictionary that is a duplicate of this
    • toString

      public String toString()
      Overrides:
      toString in class Object