public class COSDictionary extends COSBase implements COSUpdateInfo
Modifier and Type | Field and Description |
---|---|
protected Map<COSName,COSBase> |
items
The name-value pairs of this dictionary.
|
Constructor and Description |
---|
COSDictionary()
Constructor.
|
COSDictionary(COSDictionary dict)
Copy Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
COSDictionary |
asUnmodifiableDictionary()
Returns an unmodifiable view of this dictionary.
|
void |
clear()
This will clear all items in the map.
|
boolean |
containsKey(COSName name) |
boolean |
containsKey(String name) |
boolean |
containsValue(Object value) |
Set<Map.Entry<COSName,COSBase>> |
entrySet()
Returns the name-value entries in this dictionary.
|
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.
|
boolean |
getBoolean(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.
|
COSName |
getCOSName(COSName key)
This is a convenience method that will get the dictionary object that is expected to be a name.
|
COSName |
getCOSName(COSName key,
COSName defaultValue)
This is a convenience method that will get the dictionary object that is expected to be a name.
|
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.
|
Calendar |
getDate(COSName key,
Calendar defaultValue)
This is a convenience method that will get the dictionary object that is expected to be a date.
|
Calendar |
getDate(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.
|
Calendar |
getDate(String key,
Calendar defaultValue)
This is a convenience method that will get the dictionary object that is expected to be a date.
|
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.
|
COSBase |
getDictionaryObject(String key)
This will get an object from this dictionary.
|
COSBase |
getDictionaryObject(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.
|
Calendar |
getEmbeddedDate(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.
|
Calendar |
getEmbeddedDate(String embedded,
COSName key,
Calendar defaultValue)
This is a convenience method that will get the dictionary object that is expected to be a date.
|
Calendar |
getEmbeddedDate(String embedded,
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.
|
Calendar |
getEmbeddedDate(String embedded,
String key,
Calendar defaultValue)
This is a convenience method that will get the dictionary object that is expected to be a date.
|
int |
getEmbeddedInt(String embeddedDictionary,
COSName key)
Get an integer from an embedded dictionary.
|
int |
getEmbeddedInt(String embeddedDictionary,
COSName key,
int defaultValue)
Get an integer from an embedded dictionary.
|
int |
getEmbeddedInt(String embeddedDictionary,
String key)
Get an integer from an embedded dictionary.
|
int |
getEmbeddedInt(String embeddedDictionary,
String key,
int defaultValue)
Get an integer from an embedded dictionary.
|
String |
getEmbeddedString(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.
|
String |
getEmbeddedString(String embedded,
COSName key,
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.
|
String |
getEmbeddedString(String embedded,
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.
|
String |
getEmbeddedString(String embedded,
String key,
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.
|
boolean |
getFlag(COSName field,
int bitFlag)
Gets the boolean value from the flags at the given bit position.
|
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.
|
float |
getFloat(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(String key,
float defaultValue)
This is a convenience method that will get the dictionary object that is expected to be a float.
|
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 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.
|
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(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(String[] keyList,
int defaultValue)
This is a convenience method that will get the dictionary object that is expected to be an integer.
|
int |
getInt(String key,
int defaultValue)
This is a convenience method that will get the dictionary object that is expected to be an integer.
|
COSBase |
getItem(COSName key)
This will do a lookup into the dictionary.
|
COSBase |
getItem(String key)
This will do a lookup into the dictionary.
|
COSName |
getKeyForValue(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(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.
|
long |
getLong(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(String[] keyList,
long defaultValue)
This is a convenience method that will get the dictionary object that is expected to be an long.
|
long |
getLong(String key,
long defaultValue)
This is a convenience method that will get the dictionary object that is expected to be an integer.
|
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.
|
String |
getNameAsString(COSName key,
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.
|
String |
getNameAsString(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.
|
String |
getNameAsString(String key,
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(String objPath)
Nice method, gives you every object you want Arrays works properly too.
|
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.
|
String |
getString(COSName key,
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.
|
String |
getString(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.
|
String |
getString(String key,
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.
|
Collection<COSBase> |
getValues()
This will get all of the values for the dictionary.
|
boolean |
isNeedToBeUpdated()
Get the update state for the COSWriter.
|
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(COSName key,
boolean value)
This will set an item in the dictionary.
|
void |
setBoolean(String key,
boolean value)
This will set an item in the dictionary.
|
void |
setDate(COSName key,
Calendar date)
Set the date object.
|
void |
setDate(String key,
Calendar date)
Set the value of a date entry in the dictionary.
|
void |
setEmbeddedDate(String embedded,
COSName key,
Calendar date)
Set the date object.
|
void |
setEmbeddedDate(String embedded,
String key,
Calendar date)
Set the value of a date entry in the dictionary.
|
void |
setEmbeddedInt(String embeddedDictionary,
COSName key,
int value)
This is a convenience method that will convert the value to a COSInteger object.
|
void |
setEmbeddedInt(String embeddedDictionary,
String key,
int value)
This is a convenience method that will convert the value to a COSInteger object.
|
void |
setEmbeddedString(String embedded,
COSName key,
String value)
This is a convenience method that will convert the value to a COSString object.
|
void |
setEmbeddedString(String embedded,
String key,
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(COSName key,
float value)
This is a convenience method that will convert the value to a COSFloat object.
|
void |
setFloat(String key,
float value)
This is a convenience method that will convert the value to a COSFloat object.
|
void |
setInt(COSName key,
int value)
This is a convenience method that will convert the value to a COSInteger object.
|
void |
setInt(String key,
int value)
This is a convenience method that will convert the value to a COSInteger object.
|
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 |
setItem(String key,
COSBase value)
This will set an item in the dictionary.
|
void |
setItem(String key,
COSObjectable value)
This will set an item in the dictionary.
|
void |
setLong(COSName key,
long value)
This is a convenience method that will convert the value to a COSInteger object.
|
void |
setLong(String key,
long value)
This is a convenience method that will convert the value to a COSInteger object.
|
void |
setName(COSName key,
String value)
This is a convenience method that will convert the value to a COSName object.
|
void |
setName(String key,
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(COSName key,
String value)
This is a convenience method that will convert the value to a COSString object.
|
void |
setString(String key,
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.
|
String |
toString() |
getCOSObject, isDirect, setDirect
public COSDictionary()
public COSDictionary(COSDictionary dict)
dict
- The dictionary to copy.public boolean containsValue(Object value)
value
- The value to find in the map.Map.containsValue(java.lang.Object)
public COSName getKeyForValue(Object value)
value
- The value to search for in the map.public int size()
public void clear()
public COSBase getDictionaryObject(String key)
key
- The key to the object that we are getting.public COSBase getDictionaryObject(COSName firstKey, COSName secondKey)
firstKey
- The first key to try.secondKey
- The second key to try.public COSBase getDictionaryObject(String[] keyList)
keyList
- The list of keys to find a value.public COSBase getDictionaryObject(COSName key)
key
- The key to the object that we are getting.public void setItem(COSName key, COSBase value)
key
- The key to the dictionary object.value
- The value to the dictionary object.public void setItem(COSName key, COSObjectable value)
key
- The key to the dictionary object.value
- The value to the dictionary object.public void setItem(String key, COSObjectable value)
key
- The key to the dictionary object.value
- The value to the dictionary object.public void setBoolean(String key, boolean value)
key
- The key to the dictionary object.value
- The value to the dictionary object.public void setBoolean(COSName key, boolean value)
key
- The key to the dictionary object.value
- The value to the dictionary object.public void setItem(String key, COSBase value)
key
- The key to the dictionary object.value
- The value to the dictionary object.public void setName(String key, String value)
key
- The key to the object,value
- The string value for the name.public void setName(COSName key, String value)
key
- The key to the object,value
- The string value for the name.public void setDate(String key, Calendar date)
key
- The key to the date value.date
- The date value.public void setDate(COSName key, Calendar date)
key
- The key to the date.date
- The date to set.public void setEmbeddedDate(String embedded, String key, Calendar date)
embedded
- The embedded dictionary.key
- The key to the date value.date
- The date value.public void setEmbeddedDate(String embedded, COSName key, Calendar date)
embedded
- The embedded dictionary.key
- The key to the date.date
- The date to set.public void setString(String key, String value)
key
- The key to the object,value
- The string value for the name.public void setString(COSName key, String value)
key
- The key to the object,value
- The string value for the name.public void setEmbeddedString(String embedded, String key, String value)
embedded
- The embedded dictionary to set the item in.key
- The key to the object,value
- The string value for the name.public void setEmbeddedString(String embedded, COSName key, String value)
embedded
- The embedded dictionary to set the item in.key
- The key to the object,value
- The string value for the name.public void setInt(String key, int value)
key
- The key to the object,value
- The int value for the name.public void setInt(COSName key, int value)
key
- The key to the object,value
- The int value for the name.public void setLong(String key, long value)
key
- The key to the object,value
- The int value for the name.public void setLong(COSName key, long value)
key
- The key to the object,value
- The int value for the name.public void setEmbeddedInt(String embeddedDictionary, String key, int value)
embeddedDictionary
- The embedded dictionary.key
- The key to the object,value
- The int value for the name.public void setEmbeddedInt(String embeddedDictionary, COSName key, int value)
embeddedDictionary
- The embedded dictionary.key
- The key to the object,value
- The int value for the name.public void setFloat(String key, float value)
key
- The key to the object,value
- The int value for the name.public void setFloat(COSName key, float value)
key
- The key to the object,value
- The int value for the name.public void setFlag(COSName field, int bitFlag, boolean value)
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.public COSName getCOSName(COSName key)
key
- The key to the item in the dictionary.public COSName getCOSName(COSName key, COSName defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public String getNameAsString(String key)
key
- The key to the item in the dictionary.public String getNameAsString(COSName key)
key
- The key to the item in the dictionary.public String getNameAsString(String key, String defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public String getNameAsString(COSName key, String defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public String getString(String key)
key
- The key to the item in the dictionary.public String getString(COSName key)
key
- The key to the item in the dictionary.public String getString(String key, String defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The default value to return.public String getString(COSName key, String defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The default value to return.public String getEmbeddedString(String embedded, String key)
embedded
- The embedded dictionary.key
- The key to the item in the dictionary.public String getEmbeddedString(String embedded, COSName key)
embedded
- The embedded dictionary.key
- The key to the item in the dictionary.public String getEmbeddedString(String embedded, String key, String defaultValue)
embedded
- The embedded dictionary.key
- The key to the item in the dictionary.defaultValue
- The default value to return.public String getEmbeddedString(String embedded, COSName key, String defaultValue)
embedded
- The embedded dictionary.key
- The key to the item in the dictionary.defaultValue
- The default value to return.public Calendar getDate(String key)
key
- The key to the item in the dictionary.public Calendar getDate(COSName key)
key
- The key to the item in the dictionary.public Calendar getDate(String key, Calendar defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The default value to return.public Calendar getDate(COSName key, Calendar defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The default value to return.public Calendar getEmbeddedDate(String embedded, String key) throws IOException
embedded
- The embedded dictionary to get.key
- The key to the item in the dictionary.IOException
- If there is an error converting to a date.public Calendar getEmbeddedDate(String embedded, COSName key) throws IOException
embedded
- The embedded dictionary to get.key
- The key to the item in the dictionary.IOException
- If there is an error converting to a date.public Calendar getEmbeddedDate(String embedded, String key, Calendar defaultValue) throws IOException
embedded
- The embedded dictionary to get.key
- The key to the item in the dictionary.defaultValue
- The default value to return.IOException
- If there is an error converting to a date.public Calendar getEmbeddedDate(String embedded, COSName key, Calendar defaultValue) throws IOException
embedded
- The embedded dictionary to get.key
- The key to the item in the dictionary.defaultValue
- The default value to return.IOException
- If there is an error converting to a date.public boolean getBoolean(String key, boolean defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value returned if the entry is null.public boolean getBoolean(COSName key, boolean defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value returned if the entry is null.public boolean getBoolean(COSName firstKey, COSName secondKey, boolean defaultValue)
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.public int getEmbeddedInt(String embeddedDictionary, String key)
embeddedDictionary
- The name of the embedded dictionary.key
- The key in the embedded dictionary.public int getEmbeddedInt(String embeddedDictionary, COSName key)
embeddedDictionary
- The name of the embedded dictionary.key
- The key in the embedded dictionary.public int getEmbeddedInt(String embeddedDictionary, String key, int defaultValue)
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.public int getEmbeddedInt(String embeddedDictionary, COSName key, int defaultValue)
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.public int getInt(String key)
key
- The key to the item in the dictionary.public int getInt(COSName key)
key
- The key to the item in the dictionary.public int getInt(String[] keyList, int defaultValue)
keyList
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public int getInt(String key, int defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public int getInt(COSName key, int defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public int getInt(COSName firstKey, COSName secondKey)
firstKey
- The first key to the item in the dictionary.secondKey
- The second key to the item in the dictionary.public int getInt(COSName firstKey, COSName secondKey, int defaultValue)
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.public long getLong(String key)
key
- The key to the item in the dictionary.public long getLong(COSName key)
key
- The key to the item in the dictionary.public long getLong(String[] keyList, long defaultValue)
keyList
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public long getLong(String key, long defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public long getLong(COSName key, long defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public float getFloat(String key)
key
- The key to the item in the dictionary.public float getFloat(COSName key)
key
- The key to the item in the dictionary.public float getFloat(String key, float defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public float getFloat(COSName key, float defaultValue)
key
- The key to the item in the dictionary.defaultValue
- The value to return if the dictionary item is null.public boolean getFlag(COSName field, int bitFlag)
field
- The COSName of the field to get the flag from.bitFlag
- the bitPosition to get the value from.public void removeItem(COSName key)
key
- The key to the item to remove from the dictionary.public COSBase getItem(COSName key)
key
- The key to the object.public COSBase getItem(String key)
key
- The key to the object.public Set<COSName> keySet()
public Set<Map.Entry<COSName,COSBase>> entrySet()
public Collection<COSBase> getValues()
public Object accept(ICOSVisitor visitor) throws IOException
accept
in class COSBase
visitor
- The object to notify when visiting this object.IOException
- If there is an error visiting this object.public boolean isNeedToBeUpdated()
COSUpdateInfo
isNeedToBeUpdated
in interface COSUpdateInfo
public void setNeedToBeUpdated(boolean flag)
COSUpdateInfo
setNeedToBeUpdated
in interface COSUpdateInfo
flag
- the update state.public void addAll(COSDictionary dic)
dic
- The dic to get the keys from.public boolean containsKey(COSName name)
name
- The key to find in the map.Map.containsKey(Object)
public boolean containsKey(String name)
name
- The key to find in the map.Map.containsKey(Object)
public void mergeInto(COSDictionary dic)
dic
- The dic to get the keys from.public COSBase getObjectFromPath(String objPath)
objPath
- the relative path to the object.public COSDictionary asUnmodifiableDictionary()
Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.