public class COSArray extends org.apache.pdfbox.cos.COSBase implements Iterable<org.apache.pdfbox.cos.COSBase>, org.apache.pdfbox.cos.COSUpdateInfo
Copyright (c) 2020 xsx All Rights Reserved. x-easypdf is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.
| 构造器和说明 |
|---|
COSArray()
Constructor.
|
COSArray(List<? extends org.apache.pdfbox.pdmodel.common.COSObjectable> cosObjectables)
Use the given list to initialize the COSArray.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
accept(org.apache.pdfbox.cos.ICOSVisitor visitor)
Visitor pattern double dispatch method.
|
void |
add(org.apache.pdfbox.cos.COSBase object)
This will add an object to the array.
|
void |
add(org.apache.pdfbox.pdmodel.common.COSObjectable object)
This will add an object to the array.
|
void |
add(int i,
org.apache.pdfbox.cos.COSBase object)
Add the specified object at the ith location and push the rest to the
right.
|
void |
addAll(Collection<org.apache.pdfbox.cos.COSBase> objectsList)
This will add an object to the array.
|
void |
addAll(COSArray objectList)
This will add all objects to this array.
|
void |
addAll(int i,
Collection<org.apache.pdfbox.cos.COSBase> objectList)
Add the specified object at the ith location and push the rest to the
right.
|
void |
clear()
This will remove all of the objects in the collection.
|
org.apache.pdfbox.cos.COSBase |
get(int index)
This will get an object from the array.
|
void |
getIndirectObjectKeys(List<org.apache.pdfbox.cos.COSObjectKey> indirectObjects)
Collects all indirect objects numbers within this COSArray and all included dictionaries.
|
int |
getInt(int index)
Get the value of the array as an integer.
|
int |
getInt(int index,
int defaultValue)
Get the value of the array as an integer, return the default if it does not exist.
|
String |
getName(int index)
Get the value of the array as a string.
|
String |
getName(int index,
String defaultValue)
Get an entry in the array that is expected to be a COSName.
|
org.apache.pdfbox.cos.COSBase |
getObject(int index)
This will get an object from the array.
|
String |
getString(int index)
Get the value of the array as a string.
|
String |
getString(int index,
String defaultValue)
Get an entry in the array that is expected to be a COSName.
|
org.apache.pdfbox.cos.COSUpdateState |
getUpdateState()
Returns the current
COSUpdateState of this COSArray. |
void |
growToSize(int size)
This will add null values until the size of the array is at least
as large as the parameter.
|
void |
growToSize(int size,
org.apache.pdfbox.cos.COSBase object)
This will add the object until the size of the array is at least
as large as the parameter.
|
int |
indexOf(org.apache.pdfbox.cos.COSBase object)
This will return the index of the entry or -1 if it is not found.
|
int |
indexOfObject(org.apache.pdfbox.cos.COSBase object)
This will return the index of the entry or -1 if it is not found.
|
Iterator<org.apache.pdfbox.cos.COSBase> |
iterator()
Get access to the list.
|
static COSArray |
ofCOSIntegers(List<Integer> integer)
This will take a list of integer objects and return a COSArray of COSInteger objects.
|
static COSArray |
ofCOSNames(List<String> strings)
This will take a list of string objects and return a COSArray of COSName objects.
|
static COSArray |
ofCOSStrings(List<String> strings)
This will take a list of string objects and return a COSArray of COSName objects.
|
boolean |
remove(org.apache.pdfbox.cos.COSBase o)
This will remove an element from the array.
|
org.apache.pdfbox.cos.COSBase |
remove(int i)
This will remove an element from the array.
|
void |
removeAll(Collection<org.apache.pdfbox.cos.COSBase> objectsList)
This will remove all of the objects in the collection.
|
boolean |
removeObject(org.apache.pdfbox.cos.COSBase o)
This will remove an element from the array.
|
void |
retainAll(Collection<org.apache.pdfbox.cos.COSBase> objectsList)
This will retain all of the objects in the collection.
|
void |
set(int index,
org.apache.pdfbox.cos.COSBase object)
This will set an object at a specific index.
|
void |
set(int index,
org.apache.pdfbox.pdmodel.common.COSObjectable object)
This will set an object at a specific index.
|
void |
set(int index,
int intVal)
This will set an object at a specific index.
|
void |
setFloatArray(float[] value)
Clear the current contents of the COSArray and set it with the float[].
|
void |
setInt(int index,
int value)
Set the value in the array as an integer.
|
void |
setName(int index,
String name)
Set the value in the array as a name.
|
void |
setString(int index,
String string)
Set the value in the array as a string.
|
int |
size()
This will get the size of this array.
|
List<String> |
toCOSNameStringList()
This will return a list of names if the COSArray consists of COSNames only.
|
List<Float> |
toCOSNumberFloatList()
This will return a list of float values if the COSArray consists of COSNumbers only.
|
List<Integer> |
toCOSNumberIntegerList()
This will return a list of int values if the COSArray consists of COSNumbers only.
|
List<String> |
toCOSStringStringList()
This will return a list of names if the COSArray consists of COSStrings only.
|
float[] |
toFloatArray()
This will take an COSArray of numbers and convert it to a float[].
|
List<? extends org.apache.pdfbox.cos.COSBase> |
toList()
Return contents of COSArray as a Java List.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic COSArray()
public COSArray(List<? extends org.apache.pdfbox.pdmodel.common.COSObjectable> cosObjectables)
cosObjectables - the initial list of COSObjectablespublic void add(org.apache.pdfbox.cos.COSBase object)
object - The object to add to the array.public void add(org.apache.pdfbox.pdmodel.common.COSObjectable object)
object - The object to add to the array.public void add(int i,
org.apache.pdfbox.cos.COSBase object)
i - The index to add at.object - The object to add at that index.public void clear()
public void removeAll(Collection<org.apache.pdfbox.cos.COSBase> objectsList)
objectsList - The list of objects to remove from the collection.public void retainAll(Collection<org.apache.pdfbox.cos.COSBase> objectsList)
objectsList - The list of objects to retain from the collection.public void addAll(Collection<org.apache.pdfbox.cos.COSBase> objectsList)
objectsList - The object to add to the array.public void addAll(COSArray objectList)
objectList - The list of objects to add.public void addAll(int i,
Collection<org.apache.pdfbox.cos.COSBase> objectList)
i - The index to add at.objectList - The object to add at that index.public void set(int index,
org.apache.pdfbox.cos.COSBase object)
index - zero based index into array.object - The object to set.public void set(int index,
int intVal)
index - zero based index into array.intVal - The object to set.public void set(int index,
org.apache.pdfbox.pdmodel.common.COSObjectable object)
index - zero based index into array.object - The object to set.public org.apache.pdfbox.cos.COSBase getObject(int index)
index - The index into the array to get the object.public org.apache.pdfbox.cos.COSBase get(int index)
index - The index into the array to get the object.public int getInt(int index)
index - The index into the list.public int getInt(int index,
int defaultValue)
index - The value of the array.defaultValue - The value to return if the value is null.public void setInt(int index,
int value)
index - The index into the array.value - The value to set.public void setName(int index,
String name)
index - The index into the array.name - The name to set in the array.public String getName(int index)
index - The index into the array.public String getName(int index, String defaultValue)
index - The index into the array.defaultValue - The value to return if it is null.public void setString(int index,
String string)
index - The index into the array.string - The string to set in the array.public String getString(int index)
index - The index into the array.public String getString(int index, String defaultValue)
index - The index into the array.defaultValue - The value to return if it is null.public int size()
public org.apache.pdfbox.cos.COSBase remove(int i)
i - The index of the object to remove.public boolean remove(org.apache.pdfbox.cos.COSBase o)
o - The object to remove.true if the object was removed, false
otherwisepublic boolean removeObject(org.apache.pdfbox.cos.COSBase o)
o - The object to remove.true if the object was removed, false
otherwisepublic Iterator<org.apache.pdfbox.cos.COSBase> iterator()
public int indexOf(org.apache.pdfbox.cos.COSBase object)
object - The object to search for.public int indexOfObject(org.apache.pdfbox.cos.COSBase object)
object - The object to search for.public void growToSize(int size)
size - The desired size of the array.public void growToSize(int size,
org.apache.pdfbox.cos.COSBase object)
size - The desired size of the array.object - The object to fill the array with.public void accept(org.apache.pdfbox.cos.ICOSVisitor visitor)
throws IOException
accept 在类中 org.apache.pdfbox.cos.COSBasevisitor - The object to notify when visiting this object.IOException - If an error occurs while visiting this object.public float[] toFloatArray()
public void setFloatArray(float[] value)
value - The new value of the float array.public List<? extends org.apache.pdfbox.cos.COSBase> toList()
public List<String> toCOSNameStringList()
public List<String> toCOSStringStringList()
public List<Float> toCOSNumberFloatList()
public List<Integer> toCOSNumberIntegerList()
public static COSArray ofCOSIntegers(List<Integer> integer)
integer - A list of integerspublic static COSArray ofCOSNames(List<String> strings)
strings - A list of stringspublic static COSArray ofCOSStrings(List<String> strings)
strings - A list of stringspublic org.apache.pdfbox.cos.COSUpdateState getUpdateState()
COSUpdateState of this COSArray.getUpdateState 在接口中 org.apache.pdfbox.cos.COSUpdateInfoCOSUpdateState of this COSArray.COSUpdateStatepublic void getIndirectObjectKeys(List<org.apache.pdfbox.cos.COSObjectKey> indirectObjects)
Expert use only. You might run into an endless recursion if choosing a wrong starting point.
indirectObjects - a list of already found indirect objects.Copyright © 2024. All rights reserved.