public class PdfArray extends PdfObject implements Iterable<PdfObject>
PdfObject.| Modifier and Type | Field and Description |
|---|---|
protected List<PdfObject> |
list |
ARRAY, BOOLEAN, DICTIONARY, FLUSHED, FORBID_RELEASE, FREE, INDIRECT_REFERENCE, indirectReference, LITERAL, MODIFIED, MUST_BE_FLUSHED, MUST_BE_INDIRECT, NAME, NULL, NUMBER, ORIGINAL_OBJECT_STREAM, READ_ONLY, READING, STREAM, STRING, UNENCRYPTED| Constructor and Description |
|---|
PdfArray()
Create a new, empty PdfArray.
|
PdfArray(boolean[] values)
Create a new PdfArray filled with the values in the boolean[] as
PdfBoolean. |
PdfArray(double[] numbers)
Create a new PdfArray filled with the values in the double[] as
PdfNumber. |
PdfArray(float[] numbers)
Create a new PdfArray filled with the values in the float[] as
PdfNumber. |
PdfArray(int[] numbers)
Create a new PdfArray filled with the values in the int[] as
PdfNumber. |
PdfArray(Iterable<? extends PdfObject> objects,
int initialCapacity)
Create a new PdfArray.
|
PdfArray(List<? extends PdfObject> objects)
Create a new PdfArray.
|
PdfArray(List<String> strings,
boolean asNames)
Create a new PdfArray filled with a list of Strings.
|
PdfArray(PdfArray arr)
Create a new PdfArray.
|
PdfArray(PdfObject obj)
Create a new PdfArray with the provided PdfObject as the first item in the
array.
|
PdfArray(Rectangle rectangle)
Create a new PdfArray.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
PdfObject element)
Adds the specified PdfObject at the specified index.
|
void |
add(PdfObject pdfObject) |
void |
addAll(Collection<PdfObject> c)
Adds the Collection of PdfObjects.
|
void |
addAll(PdfArray a)
Adds content of the
PdfArray. |
void |
clear() |
boolean |
contains(PdfObject o) |
protected void |
copyContent(PdfObject from,
PdfDocument document)
Copies object content from object 'from'.
|
PdfArray |
copyTo(PdfDocument document)
Copies object to a specified document.
|
PdfArray |
copyTo(PdfDocument document,
boolean allowDuplicating)
Copies object to a specified document.
|
Iterator<PdfObject> |
directIterator()
Deprecated.
Use
iterator() instead. |
PdfObject |
get(int index)
Gets the (direct) PdfObject at the specified index.
|
PdfObject |
get(int index,
boolean asDirect) |
PdfArray |
getAsArray(int index)
Returns the element at the specified index as a PdfArray.
|
PdfBoolean |
getAsBoolean(int index)
Returns the element at the specified index as a PdfBoolean.
|
PdfDictionary |
getAsDictionary(int index)
Returns the element at the specified index as a PdfDictionary.
|
PdfName |
getAsName(int index)
Returns the element at the specified index as a PdfName.
|
PdfNumber |
getAsNumber(int index)
Returns the element at the specified index as a PdfNumber.
|
PdfStream |
getAsStream(int index)
Returns the element at the specified index as a PdfStream.
|
PdfString |
getAsString(int index)
Returns the element at the specified index as a PdfString.
|
byte |
getType()
Gets object type.
|
int |
indexOf(PdfObject o)
Gets the first index of the specified PdfObject.
|
boolean |
isEmpty() |
Iterator<PdfObject> |
iterator()
Returns an iterator over an array of PdfObject elements.
|
PdfArray |
makeIndirect(PdfDocument document)
Marks object to be saved as indirect.
|
PdfArray |
makeIndirect(PdfDocument document,
PdfIndirectReference reference)
Marks object to be saved as indirect.
|
protected PdfArray |
newInstance()
Creates new instance of object.
|
protected void |
releaseContent()
Release content of PdfArray.
|
void |
remove(int index)
Removes the PdfObject at the specified index.
|
void |
remove(PdfObject o)
Removes the PdfObject at the specified index.
|
PdfObject |
set(int index,
PdfObject element)
Sets the PdfObject at the specified index in the PdfArray.
|
int |
size() |
List<PdfObject> |
subList(int fromIndex,
int toIndex)
Returns a sublist of this PdfArray, starting at fromIndex (inclusive) and ending at toIndex (exclusive).
|
Rectangle |
toRectangle()
Returns the first four elements of this array as a PdfArray.
|
String |
toString() |
checkState, clearState, clone, flush, flush, getIndirectReference, isArray, isBoolean, isDictionary, isFlushed, isIndirect, isIndirectReference, isLiteral, isModified, isName, isNull, isNumber, isStream, isString, release, setIndirectReference, setModified, setStateequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic PdfArray()
public PdfArray(PdfObject obj)
obj - first item in the arraypublic PdfArray(PdfArray arr)
arr - PdfArray containing items that will added to this PdfArraypublic PdfArray(Rectangle rectangle)
rectangle - Rectangle whose 4 values will be added to the PdfArraypublic PdfArray(List<? extends PdfObject> objects)
objects - List of PdfObjects to be added to this PdfArraypublic PdfArray(float[] numbers)
PdfNumber.numbers - values to be added to this PdfArraypublic PdfArray(double[] numbers)
PdfNumber.numbers - values to be added to this PdfArraypublic PdfArray(int[] numbers)
PdfNumber.numbers - values to be added to this PdfArraypublic PdfArray(boolean[] values)
PdfBoolean.values - values to be added to this PdfArraypublic PdfArray(List<String> strings, boolean asNames)
PdfName (true) or as PdfString (false).strings - list of strings to be added to the listasNames - indicates whether the strings should be added as PdfName (true) or as PdfString (false)public int size()
public boolean isEmpty()
public boolean contains(PdfObject o)
public Iterator<PdfObject> iterator()
PdfIndirectReference instances for the indirect objects value,
you shall use get(int, boolean) method.@Deprecated public Iterator<PdfObject> directIterator()
iterator() instead.public void add(PdfObject pdfObject)
public void add(int index,
PdfObject element)
index - position to insert the PdfObjectelement - PdfObject to be addedList.add(int, Object)public PdfObject set(int index, PdfObject element)
index - the position to set the PdfObjectelement - PdfObject to be addedList.set(int, Object)public void addAll(Collection<PdfObject> c)
c - the Collection of PdfObjects to be addedList.addAll(java.util.Collection)public void addAll(PdfArray a)
PdfArray.a - the PdfArray to be addedList.addAll(java.util.Collection)public PdfObject get(int index)
index - index of the PdfObject in the PdfArraypublic void remove(int index)
index - position of the PdfObject to be removedList.remove(int)public void remove(PdfObject o)
o - a PdfObject to be removedList.remove(Object)public void clear()
public int indexOf(PdfObject o)
o - PdfObject to find the index ofList.indexOf(Object)public List<PdfObject> subList(int fromIndex, int toIndex)
fromIndex - the position of the first element in the sublist (inclusive)toIndex - the position of the last element in the sublist (exclusive)List.subList(int, int)public byte getType()
PdfObjectpublic PdfArray makeIndirect(PdfDocument document)
makeIndirect in class PdfObjectdocument - a document the indirect reference will belong to.public PdfArray makeIndirect(PdfDocument document, PdfIndirectReference reference)
makeIndirect in class PdfObjectdocument - a document the indirect reference will belong to.public PdfArray copyTo(PdfDocument document)
public PdfArray copyTo(PdfDocument document, boolean allowDuplicating)
copyTo in class PdfObjectdocument - document to copy object to.allowDuplicating - indicates if to allow copy objects which already have been copied.
If object is associated with any indirect reference and allowDuplicating is false then already existing reference will be returned instead of copying object.
If allowDuplicating is true then object will be copied and new indirect reference will be assigned.public PdfObject get(int index, boolean asDirect)
asDirect - true is to extract direct object always.public PdfArray getAsArray(int index)
index - position of the element to be returnedpublic PdfDictionary getAsDictionary(int index)
index - position of the element to be returnedpublic PdfStream getAsStream(int index)
index - position of the element to be returnedpublic PdfNumber getAsNumber(int index)
index - position of the element to be returnedpublic PdfName getAsName(int index)
index - position of the element to be returnedpublic PdfString getAsString(int index)
index - position of the element to be returnedpublic PdfBoolean getAsBoolean(int index)
index - position of the element to be returnedpublic Rectangle toRectangle()
PdfException - if one of the first values isn't a PdfNumberprotected PdfArray newInstance()
PdfObjectnewInstance in class PdfObjectprotected void copyContent(PdfObject from, PdfDocument document)
PdfObjectcopyContent in class PdfObjectfrom - object to copy content from.document - document to copy object to.protected void releaseContent()
Copyright © 1998–2017 iText Group NV. All rights reserved.