org.apache.fop.pdf

## Class PDFDictionary

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFDictionary

All Implemented Interfaces:
  PDFWritable

Direct Known Subclasses:
  PDFDPart, PDFDPartRoot, PDFEncoding, PDFFileSpec, PDFFont, PDFFontDescriptor, PDFIdentifiedDictionary, PDFNames, PDFNameTreeNode, PDFNumberTreeNode, PDFResourceContext, PDFResources, PDFRoot, StructureHierarchyMember, TransitionDictionary

    public class PDFDictionary
    extends PDFObject

Class representing a PDF dictionary object

### Field Summary

Fields
`protected Map<String,Object>` `entries` the entry map
`protected List<String>` `order` maintains the order of the entries added to the entry map.

### Fields inherited from class org.apache.fop.pdf.PDFObject

`log`

### Constructor Summary

Constructors
Constructor and Description
`PDFDictionary()` Create a new dictionary object.
`PDFDictionary(PDFObject parent)` Create a new dictionary object.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `containsKey(String name)`
`Object` `get(String name)` Returns the value given a name.
`static void` `getChildren(Collection<Object> values, Set<PDFObject> children)`
`void` `getChildren(Set<PDFObject> children)`
`Set<String>` `keySet()`
`int` `output(OutputStream stream)` Write the PDF represention of this object
`void` `put(String name, int value)` Puts a new name/value pair.
`void` `put(String name, Object value)` Puts a new name/value pair.
`void` `remove(String name)` Removes the mapping for the specified key
`protected void` `writeDictionary(OutputStream out, StringBuilder textBuffer)` Writes the contents of the dictionary to a StringBuffer.

### Methods inherited from class org.apache.fop.pdf.PDFObject

`contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, supportsObjectStream, toPDF, toPDFString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### entries

    protected Map<String,Object> entries

the entry map

#### order

    protected List<String> order

maintains the order of the entries added to the entry map. Whenever you modify "entries", always make sure you adjust this list accordingly.

### Constructor Detail

#### PDFDictionary

    public PDFDictionary()

Create a new dictionary object.

#### PDFDictionary

    public PDFDictionary(PDFObject parent)

Create a new dictionary object.

Parameters:
  `parent` - the object's parent if any

### Method Detail

#### put

    public void put(String name,
                    Object value)

Puts a new name/value pair.

Parameters:
  `name` - the name
  `value` - the value

#### put

    public void put(String name,
                    int value)

Puts a new name/value pair.

Parameters:
  `name` - the name
  `value` - the value

#### get

    public Object get(String name)

Returns the value given a name.

Parameters:
  `name` - the name of the value
Returns:
  the value or null, if there's no value with the given name.

#### output

    public int output(OutputStream stream)
               throws IOException

Write the PDF represention of this object

Overrides:
  `output` in class `PDFObject`
Parameters:
  `stream` - the stream to write the PDF to
Returns:
  the number of bytes written
Throws:
  `IOException` - if there is an error writing to the stream

#### writeDictionary

    protected void writeDictionary(OutputStream out,
                                   StringBuilder textBuffer)
                            throws IOException

Writes the contents of the dictionary to a StringBuffer.

Parameters:
  `out` - the OutputStream (for binary content)
  `textBuffer` - the text buffer for text output
Throws:
  `IOException` - if an I/O error occurs

#### getChildren

    public void getChildren(Set<PDFObject> children)

Overrides:
  `getChildren` in class `PDFObject`

#### getChildren

    public static void getChildren(Collection<Object> values,
                                   Set<PDFObject> children)

#### keySet

    public Set<String> keySet()

#### 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:
  `Map.containsKey(Object)`

#### remove

    public void remove(String name)

Removes the mapping for the specified key

Parameters:
  `name` - key whose mapping is to be removed