org.apache.fop.pdf

## Class PDFArray

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

All Implemented Interfaces:
  PDFWritable

Direct Known Subclasses:
  PDFCIELabColorSpace, PDFSeparationColorSpace

    public class PDFArray
    extends PDFObject

Class representing an array object.

### Field Summary

Fields
`protected List<Object>` `values` List holding the values of this array

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

`log`

### Constructor Summary

Constructors
Constructor and Description
`PDFArray()` Create a new, empty array object with no parent.
`PDFArray(List<?> elements)` Creates an array object made of the given elements.
`PDFArray(Object... elements)` Creates an array object made of the given elements.
`PDFArray(PDFObject parent)` Create a new, empty array object
`PDFArray(PDFObject parent, double[] values)` Create an array object.
`PDFArray(PDFObject parent, int[] values)` Create an array object.
`PDFArray(PDFObject parent, List<?> values)` Create an array object.
`PDFArray(PDFObject parent, Object[] values)` Create the array object

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `add(double value)` Adds a new value to the array.
`void` `add(Object obj)` Adds a new value to the array.
`void` `clear()` Clears the PDF array.
`boolean` `contains(Object obj)` Indicates whether the given object exists in the array.
`Object` `get(int index)` Gets an entry at a given location.
`void` `getChildren(Set<PDFObject> children)`
`int` `length()` Returns the length of the array
`int` `output(OutputStream stream)` Write the PDF represention of this object
`void` `set(int index, double value)` Sets an entry at a given location.
`void` `set(int index, Object obj)` Sets an entry at a given location.

### 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

#### values

    protected List<Object> values

List holding the values of this array

### Constructor Detail

#### PDFArray

    public PDFArray(PDFObject parent)

Create a new, empty array object

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

#### PDFArray

    public PDFArray()

Create a new, empty array object with no parent.

#### PDFArray

    public PDFArray(PDFObject parent,
                    int[] values)

Create an array object.

Parameters:
  `parent` - the array's parent if any
  `values` - the actual array wrapped by this object

#### PDFArray

    public PDFArray(PDFObject parent,
                    double[] values)

Create an array object.

Parameters:
  `parent` - the array's parent if any
  `values` - the actual array wrapped by this object

#### PDFArray

    public PDFArray(PDFObject parent,
                    List<?> values)

Create an array object.

Parameters:
  `parent` - the array's parent if any
  `values` - the actual values wrapped by this object

#### PDFArray

    public PDFArray(Object... elements)

Creates an array object made of the given elements.

Parameters:
  `elements` - the array content

#### PDFArray

    public PDFArray(List<?> elements)

Creates an array object made of the given elements.

Parameters:
  `elements` - the array content

#### PDFArray

    public PDFArray(PDFObject parent,
                    Object[] values)

Create the array object

Parameters:
  `parent` - the array's parent if any
  `values` - the actual array wrapped by this object

### Method Detail

#### contains

    public boolean contains(Object obj)

Indicates whether the given object exists in the array.

Parameters:
  `obj` - the object to look for
Returns:
  true if obj is contained

#### length

    public int length()

Returns the length of the array

Returns:
  the length of the array

#### set

    public void set(int index,
                    Object obj)

Sets an entry at a given location.

Parameters:
  `index` - the index of the value to set
  `obj` - the new value

#### set

    public void set(int index,
                    double value)

Sets an entry at a given location.

Parameters:
  `index` - the index of the value to set
  `value` - the new value

#### get

    public Object get(int index)

Gets an entry at a given location.

Parameters:
  `index` - the index of the value to set
Returns:
  the requested value

#### add

    public void add(Object obj)

Adds a new value to the array.

Parameters:
  `obj` - the value

#### add

    public void add(double value)

Adds a new value to the array.

Parameters:
  `value` - the value

#### clear

    public void clear()

Clears the PDF array.

#### 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

#### getChildren

    public void getChildren(Set<PDFObject> children)

Overrides:
  `getChildren` in class `PDFObject`