Package org.apache.pdfbox.cos
Class UnmodifiableCOSDictionary
- java.lang.Object
-
- org.apache.pdfbox.cos.COSBase
-
- org.apache.pdfbox.cos.COSDictionary
-
- org.apache.pdfbox.cos.UnmodifiableCOSDictionary
-
- All Implemented Interfaces:
COSUpdateInfo
,COSObjectable
final class UnmodifiableCOSDictionary extends COSDictionary
An unmodifiable COSDictionary.
-
-
Field Summary
-
Fields inherited from class org.apache.pdfbox.cos.COSDictionary
items
-
-
Constructor Summary
Constructors Constructor Description UnmodifiableCOSDictionary(COSDictionary dict)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAll(COSDictionary dic)
This will add all of the dictionaries keys/values to this dictionary.void
clear()
This will clear all items in the map.void
mergeInto(COSDictionary dic)
This will add all of the dictionaries 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
setFlag(COSName field, int bitFlag, boolean value)
Sets the given boolean value at bitPos in the flags.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
setNeedToBeUpdated(boolean flag)
Set the update state of the dictionary for the COSWriter.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.-
Methods inherited from class org.apache.pdfbox.cos.COSDictionary
accept, asUnmodifiableDictionary, containsKey, containsKey, containsValue, entrySet, getBoolean, getBoolean, getBoolean, getCOSArray, getCOSDictionary, getCOSName, getCOSName, getCOSObject, getCOSStream, getDate, getDate, getDate, getDate, getDictionaryObject, getDictionaryObject, getDictionaryObject, getDictionaryObject, getEmbeddedDate, getEmbeddedDate, getEmbeddedDate, getEmbeddedDate, getEmbeddedInt, getEmbeddedInt, getEmbeddedInt, getEmbeddedInt, getEmbeddedString, getEmbeddedString, getEmbeddedString, getEmbeddedString, getFlag, getFloat, getFloat, getFloat, getFloat, getInt, getInt, getInt, getInt, getInt, getInt, getInt, getItem, getItem, getItem, getKeyForValue, getLong, getLong, getLong, getLong, getLong, getNameAsString, getNameAsString, getNameAsString, getNameAsString, getObjectFromPath, getString, getString, getString, getString, getValues, isNeedToBeUpdated, keySet, size, toString
-
Methods inherited from class org.apache.pdfbox.cos.COSBase
getCOSObject, isDirect, setDirect
-
-
-
-
Constructor Detail
-
UnmodifiableCOSDictionary
UnmodifiableCOSDictionary(COSDictionary dict)
-
-
Method Detail
-
clear
public void clear()
This will clear all items in the map.- Overrides:
clear
in classCOSDictionary
-
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 ).- Overrides:
setItem
in classCOSDictionary
- 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 ).- Overrides:
setItem
in classCOSDictionary
- 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 ).- Overrides:
setItem
in classCOSDictionary
- 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.- Overrides:
setBoolean
in classCOSDictionary
- 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.- Overrides:
setBoolean
in classCOSDictionary
- 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 ).- Overrides:
setItem
in classCOSDictionary
- 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.- Overrides:
setName
in classCOSDictionary
- 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.- Overrides:
setName
in classCOSDictionary
- 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.- Overrides:
setDate
in classCOSDictionary
- 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.- Overrides:
setDate
in classCOSDictionary
- 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.- Overrides:
setEmbeddedDate
in classCOSDictionary
- 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.- Overrides:
setEmbeddedDate
in classCOSDictionary
- 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.- Overrides:
setString
in classCOSDictionary
- 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.- Overrides:
setString
in classCOSDictionary
- 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.- Overrides:
setEmbeddedString
in classCOSDictionary
- 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.- Overrides:
setEmbeddedString
in classCOSDictionary
- 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.- Overrides:
setInt
in classCOSDictionary
- 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.- Overrides:
setInt
in classCOSDictionary
- 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.- Overrides:
setLong
in classCOSDictionary
- 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.- Overrides:
setLong
in classCOSDictionary
- 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.- Overrides:
setEmbeddedInt
in classCOSDictionary
- 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.- Overrides:
setEmbeddedInt
in classCOSDictionary
- 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.- Overrides:
setFloat
in classCOSDictionary
- 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.- Overrides:
setFloat
in classCOSDictionary
- Parameters:
key
- The key to the object,value
- The int value for the name.
-
removeItem
public void removeItem(COSName key)
This will remove an item for the dictionary. This will do nothing of the object does not exist.- Overrides:
removeItem
in classCOSDictionary
- Parameters:
key
- The key to the item to remove from the dictionary.
-
addAll
public void addAll(COSDictionary dic)
This will add all of the dictionaries keys/values to this dictionary. Existing key/value pairs will be overwritten.- Overrides:
addAll
in classCOSDictionary
- Parameters:
dic
- The dictionaries to get the key/value pairs from.
-
mergeInto
public void mergeInto(COSDictionary dic)
This will add 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.- Overrides:
mergeInto
in classCOSDictionary
- Parameters:
dic
- The dictionaries to get the keys from.
-
setFlag
public void setFlag(COSName field, int bitFlag, boolean value)
Sets the given boolean value at bitPos in the flags.- Overrides:
setFlag
in classCOSDictionary
- 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.
-
setNeedToBeUpdated
public void setNeedToBeUpdated(boolean flag)
Set the update state of the dictionary for the COSWriter. This indicates whether an object is to be written when there is an incremental save.- Specified by:
setNeedToBeUpdated
in interfaceCOSUpdateInfo
- Overrides:
setNeedToBeUpdated
in classCOSDictionary
- Parameters:
flag
- the update state.
-
-