Class PDFArray

java.lang.Object
com.datalogics.PDFL.PDFObject
com.datalogics.PDFL.PDFArray

public class PDFArray extends PDFObject
Represents an array of data elements within a PDF document. All objects in a PDF document are built from a collection of simpler objects that represent fundamental datatypes like numbers, strings and arrays. PDFObject and its subclasses allow direct access and manipulation of these simple objects. Some subclasses represent single data elements. For example, PDFInteger represents a single integer value. Others represent a collection of PDFObjects, like PDFArray, an indexed array of data elements.

A PDFArray is a heterogenous collection object that gathers other PDFObjects (including other PDFArrays) into an indexed list.

  • Constructor Details

    • PDFArray

      public PDFArray(Document doc, boolean indirect)
      General constructor

      Parameters:
      doc - Document object containing this PDFArray
      indirect - flag marking this as an indirect PDFObject
    • PDFArray

      public PDFArray(PDFObject docFromObj, boolean indirect)
      General constructor

      Parameters:
      docFromObj - The new PDFArray will be created in the same document as this object.
      indirect - flag marking this as an indirect PDFObject
  • Method Details

    • delete

      public void delete()
      Overrides:
      delete in class PDFObject
    • toString

      public String toString()
      Overrides:
      toString in class PDFObject
    • add

      public void add(PDFObject object)
      Adds an object to the end of the array
    • put

      public void put(int index, PDFObject obj)
      Puts an object at the given index, replacing the existing item. The index can be greater than the current length of the array; the array will be extended and the empty slots filled with null objects.

    • insert

      public void insert(int index, PDFObject object)
      Inserts an object at the given index, displacing existing objects. All objects following this will have their index increased by one.

    • remove

      public void remove(PDFObject object)
      Removes the first object that matches the given object. The length of the array is reduced by 1.

    • removeAt

      public void removeAt(int index)
      Removes the object at the given index. The length of the array is reduced by 1.

    • get

      public PDFObject get(int index)
      Returns the object at the given index.

    • getLength

      public int getLength()
      The number of elements in this array.