Package org.apache.pdfbox.pdmodel.common
Class COSArrayList<E>
java.lang.Object
org.apache.pdfbox.pdmodel.common.COSArrayList<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,List<E>
This is an implementation of a List that will sync its contents to a COSArray.
- Version:
- $Revision: 1.15 $
- Author:
- Ben Litchfield
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.COSArrayList
(E actualObject, COSBase item, COSDictionary dictionary, String dictionaryKey) Deprecated.COSArrayList
(E actualObject, COSBase item, COSDictionary dictionary, COSName dictionaryKey) This is a really special constructor.COSArrayList
(List<E> actualList, COSArray cosArray) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection<? extends E> c) boolean
addAll
(Collection<? extends E> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) convertCOSNameCOSArrayToList
(COSArray nameArray) This will take an array of COSName and return a COSArrayList of java.lang.String values.convertCOSStringCOSArrayToList
(COSArray stringArray) This will take an array of COSString and return a COSArrayList of java.lang.String values.static COSArray
converterToCOSArray
(List<?> cosObjectableList) This will convert a list of COSObjectables to an array list of COSBase objects.convertFloatCOSArrayToList
(COSArray floatArray) This will take an array of COSNumbers and return a COSArrayList of java.lang.Float values.convertIntegerCOSArrayToList
(COSArray intArray) This will take an array of COSNumbers and return a COSArrayList of java.lang.Integer values.static COSArray
convertStringListToCOSNameCOSArray
(List<String> strings) This will take an list of string objects and return a COSArray of COSName objects.static COSArray
convertStringListToCOSStringCOSArray
(List<String> strings) This will take an list of string objects and return a COSArray of COSName objects.boolean
get
(int index) int
hashCode()
int
boolean
isEmpty()
iterator()
int
listIterator
(int index) remove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
subList
(int fromIndex, int toIndex) Object[]
toArray()
<X> X[]
toArray
(X[] a) toList()
This will return then underlying COSArray.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Constructor Details
-
COSArrayList
public COSArrayList()Default constructor. -
COSArrayList
Constructor.- Parameters:
actualList
- The list of standard java objectscosArray
- The COS array object to sync to.
-
COSArrayList
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.
-
COSArrayList
Deprecated.use theCOSArrayList(Object, COSBase, COSDictionary, COSName)
method instead
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <X> X[] toArray(X[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
-
addAll
-
addAll
-
convertIntegerCOSArrayToList
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.
-
convertFloatCOSArrayToList
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.
-
convertCOSNameCOSArrayToList
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
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.
-
convertStringListToCOSNameCOSArray
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
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
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.
-
removeAll
-
retainAll
-
clear
public void clear() -
equals
-
hashCode
public int hashCode() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
subList
-
toString
-
toList
This will return then underlying COSArray.- Returns:
- the COSArray
-
COSArrayList(Object, COSBase, COSDictionary, COSName)
method instead