Save This Page
Home » pdfbox-1.1.0-src » org.apache.pdfbox.cos » [javadoc | source]
org.apache.pdfbox.cos
public class: COSDictionary [javadoc | source]
java.lang.Object
   org.apache.pdfbox.cos.COSBase
      org.apache.pdfbox.cos.COSDictionary

All Implemented Interfaces:
    COSObjectable

Direct Known Subclasses:
    COSStream, COSStreamArray

This class represents a dictionary where name/value pairs reside.
Constructor:
 public COSDictionary() 
 public COSDictionary(COSDictionary dict) 
    Copy Constructor. This will make a shallow copy of this dictionary.
    Parameters:
    dict - The dictionary to copy.
Method from org.apache.pdfbox.cos.COSDictionary Summary:
accept,   addAll,   clear,   containsValue,   entrySet,   getBoolean,   getBoolean,   getDate,   getDate,   getDate,   getDate,   getDictionaryObject,   getDictionaryObject,   getDictionaryObject,   getDictionaryObject,   getEmbeddedDate,   getEmbeddedDate,   getEmbeddedDate,   getEmbeddedDate,   getEmbeddedInt,   getEmbeddedInt,   getEmbeddedInt,   getEmbeddedInt,   getEmbeddedString,   getEmbeddedString,   getEmbeddedString,   getEmbeddedString,   getFloat,   getFloat,   getFloat,   getFloat,   getInt,   getInt,   getInt,   getInt,   getInt,   getItem,   getKeyForValue,   getLong,   getLong,   getLong,   getLong,   getLong,   getNameAsString,   getNameAsString,   getNameAsString,   getNameAsString,   getObjectFromPath,   getString,   getString,   getString,   getString,   getValues,   keyList,   keySet,   mergeInto,   removeItem,   setBoolean,   setBoolean,   setDate,   setDate,   setEmbeddedDate,   setEmbeddedDate,   setEmbeddedInt,   setEmbeddedInt,   setEmbeddedString,   setEmbeddedString,   setFloat,   setFloat,   setInt,   setInt,   setItem,   setItem,   setItem,   setItem,   setLong,   setLong,   setName,   setName,   setString,   setString,   size,   toString
Methods from org.apache.pdfbox.cos.COSBase:
accept,   getCOSObject,   getFilterManager
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.pdfbox.cos.COSDictionary Detail:
 public Object accept(ICOSVisitor visitor) throws COSVisitorException 
    visitor pattern double dispatch method.
 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.
 public  void clear() 
    This will clear all items in the map.
 public boolean containsValue(Object value) 
 public Set<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.
 public 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.
 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.
 public Calendar getDate(String key) throws 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.
 public Calendar getDate(COSName key) throws 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.
 public Calendar getDate(String key,
    Calendar defaultValue) throws 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.
 public Calendar getDate(COSName key,
    Calendar defaultValue) throws 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.
 public COSBase getDictionaryObject(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.
 public 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. 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.
 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.
 public COSBase getDictionaryObject(String firstKey,
    String 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.
 public Calendar getEmbeddedDate(String embedded,
    String key) throws 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.
 public Calendar getEmbeddedDate(String embedded,
    COSName key) throws 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.
 public Calendar getEmbeddedDate(String embedded,
    String key,
    Calendar defaultValue) throws 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.
 public Calendar getEmbeddedDate(String embedded,
    COSName key,
    Calendar defaultValue) throws 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.
 public int getEmbeddedInt(String embeddedDictionary,
    String key) 
    Get an integer from an embedded dictionary. Useful for 1-1 mappings. default:-1
 public int getEmbeddedInt(String embeddedDictionary,
    COSName key) 
    Get an integer from an embedded dictionary. Useful for 1-1 mappings. default:-1
 public int getEmbeddedInt(String embeddedDictionary,
    String key,
    int defaultValue) 
    Get an integer from an embedded dictionary. Useful for 1-1 mappings.
 public int getEmbeddedInt(String embeddedDictionary,
    COSName key,
    int defaultValue) 
    Get an integer from an embedded dictionary. Useful for 1-1 mappings.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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.
 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.
 public float getFloat(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.
 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.
 public 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.
 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.
 public int getInt(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.
 public int getInt(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.
 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.
 public COSBase getItem(COSName key) 
    This will do a lookup into the dictionary.
 public 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.
 public 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.
 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.
 public long getLong(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.
 public long getLong(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.
 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.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public COSBase getObjectFromPath(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.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public 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. Null is returned if the entry does not exist in the dictionary.
 public Collection<COSBase> getValues() 
    This will get all of the values for the dictionary.
 public 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.
 public 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.
 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.
 public  void removeItem(COSName key) 
    This will remove an item for the dictionary. This will do nothing of the object does not exist.
 public  void setBoolean(String key,
    boolean value) 
    This will set an item in the dictionary.
 public  void setBoolean(COSName key,
    boolean value) 
    This will set an item in the dictionary.
 public  void setDate(String key,
    Calendar date) 
    Set the value of a date entry in the dictionary.
 public  void setDate(COSName key,
    Calendar date) 
    Set the date object.
 public  void setEmbeddedDate(String embedded,
    String key,
    Calendar date) 
    Set the value of a date entry in the dictionary.
 public  void setEmbeddedDate(String embedded,
    COSName key,
    Calendar date) 
    Set the date object.
 public  void setEmbeddedInt(String embeddedDictionary,
    String key,
    int value) 
    This is a convenience method that will convert the value to a COSInteger object.
 public  void setEmbeddedInt(String embeddedDictionary,
    COSName key,
    int value) 
    This is a convenience method that will convert the value to a COSInteger object.
 public  void setEmbeddedString(String embedded,
    String key,
    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.
 public  void setEmbeddedString(String embedded,
    COSName key,
    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.
 public  void setFloat(String key,
    float value) 
    This is a convenience method that will convert the value to a COSFloat object.
 public  void setFloat(COSName key,
    float value) 
    This is a convenience method that will convert the value to a COSFloat object.
 public  void setInt(String key,
    int value) 
    This is a convenience method that will convert the value to a COSInteger object.
 public  void setInt(COSName key,
    int value) 
    This is a convenience method that will convert the value to a COSInteger object.
 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 ).
 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 ).
 public  void setItem(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 ).
 public  void setItem(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 ).
 public  void setLong(String key,
    long value) 
    This is a convenience method that will convert the value to a COSInteger object.
 public  void setLong(COSName key,
    long value) 
    This is a convenience method that will convert the value to a COSInteger object.
 public  void setName(String key,
    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.
 public  void setName(COSName key,
    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.
 public  void setString(String key,
    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.
 public  void setString(COSName key,
    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.
 public int size() 
    This will return the number of elements in this dictionary.
 public String toString() 
    {@inheritDoc}