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).
|
double[] |
toDoubleArray()
Returns this array as an array of doubles.
|
float[] |
toFloatArray()
Returns this array as an array of floats.
|
int[] |
toIntArray()
Returns this array as an array of ints.
|
long[] |
toLongArray()
Returns this array as an array of longs.
|
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, setState
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public PdfArray()
public PdfArray(PdfObject obj)
obj
- first item in the array
public PdfArray(PdfArray arr)
arr
- PdfArray containing items that will added to this PdfArray
public PdfArray(Rectangle rectangle)
rectangle
- Rectangle whose 4 values will be added to the PdfArray
public PdfArray(List extends PdfObject> objects)
objects
- List of PdfObjects to be added to this PdfArray
public PdfArray(float[] numbers)
PdfNumber
.
numbers
- values to be added to this PdfArray
public PdfArray(double[] numbers)
PdfNumber
.
numbers
- values to be added to this PdfArray
public PdfArray(int[] numbers)
PdfNumber
.
numbers
- values to be added to this PdfArray
public PdfArray(boolean[] values)
PdfBoolean
.
values
- values to be added to this PdfArray
public PdfArray(List<String> strings, boolean asNames)
PdfName
(true) or as PdfString
(false).
strings
- list of strings to be added to the list
asNames
- 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 PdfObject
element
- PdfObject to be added
List.add(int, Object)
public PdfObject set(int index, PdfObject element)
index
- the position to set the PdfObject
element
- PdfObject to be added
List.set(int, Object)
public void addAll(Collection<PdfObject> c)
c
- the Collection of PdfObjects to be added
List.addAll(java.util.Collection)
public void addAll(PdfArray a)
PdfArray
.
a
- the PdfArray
to be added
List.addAll(java.util.Collection)
public PdfObject get(int index)
index
- index of the PdfObject in the PdfArray
public void remove(int index)
index
- position of the PdfObject to be removed
List.remove(int)
public void remove(PdfObject o)
o
- a PdfObject to be removed
List.remove(Object)
public void clear()
public int indexOf(PdfObject o)
o
- PdfObject to find the index of
List.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()
PdfObject
public PdfArray makeIndirect(PdfDocument document)
makeIndirect
in class PdfObject
document
- a document the indirect reference will belong to.
public PdfArray makeIndirect(PdfDocument document, PdfIndirectReference reference)
makeIndirect
in class PdfObject
document
- a document the indirect reference will belong to.
public PdfArray copyTo(PdfDocument document)
public PdfArray copyTo(PdfDocument document, boolean allowDuplicating)
copyTo
in class PdfObject
document
- 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 returned
public PdfDictionary getAsDictionary(int index)
index
- position of the element to be returned
public PdfStream getAsStream(int index)
index
- position of the element to be returned
public PdfNumber getAsNumber(int index)
index
- position of the element to be returned
public PdfName getAsName(int index)
index
- position of the element to be returned
public PdfString getAsString(int index)
index
- position of the element to be returned
public PdfBoolean getAsBoolean(int index)
index
- position of the element to be returned
public Rectangle toRectangle()
PdfException
- if one of the first values isn't a PdfNumber
public float[] toFloatArray()
PdfException
- if one of the values isn't a number
public double[] toDoubleArray()
PdfException
- if one of the values isn't a number
public long[] toLongArray()
PdfException
- if one of the values isn't a number
public int[] toIntArray()
PdfException
- if one of the values isn't a number
protected PdfArray newInstance()
PdfObject
newInstance
in class PdfObject
protected void copyContent(PdfObject from, PdfDocument document)
PdfObject
copyContent
in class PdfObject
from
- object to copy content from.
document
- document to copy object to.
protected void releaseContent()
Copyright © 1998–2018 iText Group NV. All rights reserved.