org.pdfbox.pdmodel.common

Class COSArrayList

Implemented Interfaces:
List

public class COSArrayList
extends java.lang.Object
implements List

This is an implementation of a List that will sync its contents to a COSArray.
Version:
$Revision: 1.15 $
Author:
Ben Litchfield

Constructor Summary

COSArrayList()
Default constructor.
COSArrayList(List actualList, COSArray cosArray)
Constructor.
COSArrayList(Object actualObject, COSBase item, COSDictionary dictionary, String dictionaryKey)
This is a really special constructor.

Method Summary

boolean
add(Object o)
void
add(int index, Object element)
boolean
addAll(Collection c)
boolean
addAll(int index, Collection c)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection c)
static List
convertCOSNameCOSArrayToList(COSArray nameArray)
This will take an array of COSName and return a COSArrayList of java.lang.String values.
static List
convertCOSStringCOSArrayToList(COSArray stringArray)
This will take an array of COSString and return a COSArrayList of java.lang.String values.
static List
convertFloatCOSArrayToList(COSArray floatArray)
This will take an array of COSNumbers and return a COSArrayList of java.lang.Float values.
static List
convertIntegerCOSArrayToList(COSArray intArray)
This will take an array of COSNumbers and return a COSArrayList of java.lang.Integer values.
static COSArray
convertStringListToCOSNameCOSArray(List strings)
This will take an list of string objects and return a COSArray of COSName objects.
static COSArray
convertStringListToCOSStringCOSArray(List strings)
This will take an list of string objects and return a COSArray of COSName objects.
static COSArray
converterToCOSArray(List cosObjectableList)
This will convert a list of COSObjectables to an array list of COSBase objects.
boolean
equals(Object o)
Object
get(int index)
int
hashCode()
int
indexOf(Object o)
boolean
isEmpty()
Iterator
iterator()
int
lastIndexOf(Object o)
ListIterator
listIterator()
ListIterator
listIterator(int index)
boolean
remove(Object o)
Object
remove(int index)
boolean
removeAll(Collection c)
boolean
retainAll(Collection c)
Object
set(int index, Object element)
int
size()
List
subList(int fromIndex, int toIndex)
Object[]
toArray()
Object[]
toArray(Object[] a)

Constructor Details

COSArrayList

public COSArrayList()
Default constructor.

COSArrayList

public COSArrayList(List actualList,
                    COSArray cosArray)
Constructor.
Parameters:
actualList - The list of standard java objects
cosArray - The COS array object to sync to.

COSArrayList

public COSArrayList(Object actualObject,
                    COSBase item,
                    COSDictionary dictionary,
                    String dictionaryKey)
This is a really special constructor. Sometimes the PDF spec says that a dictionary entry can either be a single item or an array of those items. But in the PDModel interface we really just want to always return a java.util.List. In the case were we get the list and never modify it we don't want to convert to COSArray and put one element, unless we append to the list. So here we are going to create this object with a single item instead of a list, but allow more items to be added and then converted to an array.
Parameters:
actualObject - The PDModel object.
item - The COS Model object.
dictionary - The dictionary that holds the item, and will hold the array if an item is added.
dictionaryKey - The key into the dictionary to set the item.

Method Details

add

public boolean add(Object o)

add

public void add(int index,
                Object element)

addAll

public boolean addAll(Collection c)

addAll

public boolean addAll(int index,
                      Collection c)

clear

public void clear()

contains

public boolean contains(Object o)

containsAll

public boolean containsAll(Collection c)

convertCOSNameCOSArrayToList

public static List convertCOSNameCOSArrayToList(COSArray nameArray)
This will take an array of COSName and return a COSArrayList of java.lang.String values.
Parameters:
nameArray - The existing name Array.
Returns:
The list of String objects.

convertCOSStringCOSArrayToList

public static List convertCOSStringCOSArrayToList(COSArray stringArray)
This will take an array of COSString and return a COSArrayList of java.lang.String values.
Parameters:
stringArray - The existing name Array.
Returns:
The list of String objects.

convertFloatCOSArrayToList

public static List convertFloatCOSArrayToList(COSArray floatArray)
This will take an array of COSNumbers and return a COSArrayList of java.lang.Float values.
Parameters:
floatArray - The existing float Array.
Returns:
The list of Float objects.

convertIntegerCOSArrayToList

public static List convertIntegerCOSArrayToList(COSArray intArray)
This will take an array of COSNumbers and return a COSArrayList of java.lang.Integer values.
Parameters:
intArray - The existing integer Array.
Returns:
A list that is part of the core Java collections.

convertStringListToCOSNameCOSArray

public static COSArray convertStringListToCOSNameCOSArray(List strings)
This will take an list of string objects and return a COSArray of COSName objects.
Parameters:
strings - A list of strings
Returns:
An array of COSName objects

convertStringListToCOSStringCOSArray

public static COSArray convertStringListToCOSStringCOSArray(List strings)
This will take an list of string objects and return a COSArray of COSName objects.
Parameters:
strings - A list of strings
Returns:
An array of COSName objects

converterToCOSArray

public static COSArray converterToCOSArray(List cosObjectableList)
This will convert a list of COSObjectables to an array list of COSBase objects.
Parameters:
cosObjectableList - A list of COSObjectable.
Returns:
A list of COSBase.

equals

public boolean equals(Object o)

get

public Object get(int index)

hashCode

public int hashCode()

indexOf

public int indexOf(Object o)

isEmpty

public boolean isEmpty()

iterator

public Iterator iterator()

lastIndexOf

public int lastIndexOf(Object o)

listIterator

public ListIterator listIterator()

listIterator

public ListIterator listIterator(int index)

remove

public boolean remove(Object o)

remove

public Object remove(int index)

removeAll

public boolean removeAll(Collection c)

retainAll

public boolean retainAll(Collection c)

set

public Object set(int index,
                  Object element)

size

public int size()

subList

public List subList(int fromIndex,
                    int toIndex)

toArray

public Object[] toArray()

toArray

public Object[] toArray(Object[] a)