|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.intarsys.pdf.cos.COSDocumentElement
de.intarsys.pdf.cos.COSObject
de.intarsys.pdf.cos.COSCompositeObject
de.intarsys.pdf.cos.COSArray
public class COSArray
A COSArray represents an indexed collection of COSDocumentElement
instances.
Using the standard access methods, always "dereferenced" COSObject
instances are returned. Use the "basic" falvor of methods to access the
optional COSIndirectObject
.
Field Summary |
---|
Fields inherited from class de.intarsys.pdf.cos.COSObject |
---|
CONSTANT_CONTAINER, NULL_CONTAINER, SLOT_CONTAINER |
Method Summary | |
---|---|
Object |
accept(ICOSObjectVisitor visitor)
Accept a visitor object. |
COSArray |
add(COSObject object)
Add a COSObject to the collection. |
COSArray |
add(int index,
COSObject object)
Add a COSObject to the collection. |
COSArray |
asArray()
this as a COSArray or null |
COSArray |
basicAddSilent(COSDocumentElement element)
Add a document element (an object or a reference) to the collection. |
COSDocumentElement |
basicGet(int index)
Get the COSDocumentElement (an object or a reference) from this
at the specified index. |
Iterator |
basicIterator()
An iterator that returns all contained COSDocumentElement
instances without dereferencing. |
void |
clear()
Remove all elements from this. |
COSObject |
copyDeep(Map copied)
Make a deep copy of the receiver within the same document. |
COSObject |
copyShallow()
Make a copy of the receiver. |
static COSArray |
create()
Create an empty COSArray . |
static COSArray |
create(int size)
Create an empty COSArray with a preallocated size. |
static COSArray |
createWith(float a,
float b,
float c,
float d)
Shortcut for fast creation of rectangle arrays |
static COSArray |
createWith(float a,
float b,
float c,
float d,
float e,
float f)
Shortcut for fast creation of matrix arrays |
boolean |
equals(Object o)
|
COSObject |
get(int index)
The COSObject at the given index. |
List |
getObjects()
A copy of all COSObject's in this. |
int |
hashCode()
ATTENTION: this implementation returns a hash code that does not remain constant when manipulating the arrays content |
int |
indexOf(COSObject object)
The index of object within this or -1 if not found. |
boolean |
isEmpty()
true if this.size() == 0 . |
Iterator |
iterator()
An iterator over contained objects. |
COSIndirectObject |
referenceIndirect(COSObject object)
Change the reference to the object contained in this to an indirect one via reference. |
boolean |
remove(COSObject object)
Remove object from this. |
COSObject |
remove(int index)
Remove the object at index from the collection. |
void |
restoreState(Object object)
|
Object |
saveState()
|
COSObject |
set(int i,
COSObject object)
Replace the object at index i with object . |
int |
size()
The number of elements in this. |
Methods inherited from class de.intarsys.pdf.cos.COSCompositeObject |
---|
addObjectListener, associate, containable, copyDeep, disassociate, getAttribute, isObjectListenerAvailable, isPrimitive, referenceCount, register, removeAttribute, removeObjectListener, restoreStateContainer, saveStateContainer, setAttribute, willChange |
Methods inherited from class de.intarsys.pdf.cos.COSObject |
---|
asBoolean, asDictionary, asFixed, asInteger, asName, asNull, asNumber, asStream, asString, beConstant, beIndirect, containable, copyOptional, copySubGraph, dereference, getContainer, getDoc, getIndirectObject, isDangling, isIndirect, isNull, isNumber, isSwapped, stringValue, toString |
Methods inherited from class de.intarsys.pdf.cos.COSDocumentElement |
---|
handleException, isReference |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.intarsys.pdf.cos.ICOSContainer |
---|
getDoc |
Method Detail |
---|
public static COSArray create()
COSArray
.
COSArray
.public static COSArray create(int size)
COSArray
with a preallocated size.
COSArray
.public static COSArray createWith(float a, float b, float c, float d)
a
- b
- c
- d
-
public static COSArray createWith(float a, float b, float c, float d, float e, float f)
a
- b
- c
- d
- e
- f
-
public List getObjects()
Indirect objects and dangling references are handled by this method.
public Object accept(ICOSObjectVisitor visitor) throws COSVisitorException
COSDocumentElement
visitor
by "double dispatching".
accept
in class COSDocumentElement
visitor
- The object visiting the receiver.
COSVisitorException
- An exception depending on the visitor semantics.public COSArray add(COSObject object)
COSObject
to the collection.
This method takes care of change propagation for incremental writing.
this method should be used by the application level programmer to ensure he deals not with references.
object
- the object to be added
public COSArray add(int index, COSObject object)
COSObject
to the collection.
This method takes care of change propagation for incremental writing.
this method should be used by the application level programmer to ensure he deals not with references.
index
- The index where to insert object
object
- the object to be added
public COSArray basicAddSilent(COSDocumentElement element)
The change is not propagated.
This should not be used by the application level programmer. It is public for package visibility reasons.
element
- the element to be added
public COSDocumentElement basicGet(int index)
COSDocumentElement
(an object or a reference) from this
at the specified index.
This method should only be used for low level programming.
index
- The index into this
COSDocumentElement
(an object or a reference)
from this at the specified index.public Iterator basicIterator()
COSDocumentElement
instances without dereferencing.
This should be used in low level programming.
basicIterator
in class COSObject
COSDocumentElement
instances without dereferencing.public void clear()
public COSObject copyShallow()
COSObject
A copy is made of the receiver and after this recursively of all not indirect objects.
Be careful when copying objects, as there are semantics that may NOT be recognized by this method.
copyShallow
in class COSObject
public boolean equals(Object o)
equals
in class Object
public COSObject get(int index)
COSObject
at the given index. Any index outisde the valid
array range results in COSNull (compare Adobe Core ApI Reference).
index
- The index of the COSObject
to select from this.
COSObject
at the given index or COSNull
.public int hashCode()
hashCode
in class Object
Object.hashCode()
public int indexOf(COSObject object)
object
within this or -1 if not found.
object
- The object to be searched within this.
object
within this or -1 if not
found.public Iterator iterator()
COSObject
This iterator returns only COSObject instances, references are dereferenced.
iterator
in class COSObject
public COSIndirectObject referenceIndirect(COSObject object)
COSCompositeObject
This method must be redefined by all containers to reflect the new reference type in their child references.
This event is delegated to the document to create the correct state for a new indirect object. If a document is not yet present, the state is changed when the COSObject (s) are added to the document finally. This can happen when constructing a COSObject graph "offline" and later add it to the document.
From the COS invariants you can be sure that the object referenced by ref is contained in this at most once
referenceIndirect
in interface ICOSContainer
referenceIndirect
in class COSCompositeObject
object
- The object to be indirectpublic boolean remove(COSObject object)
object
from this. If object
is not
contained, nothing happens.
This method cycles all elements wich may cause heavy lazy loading.
object
- The object to remove from this.
true
if object
was removed.public COSObject remove(int index)
index
from the collection.
index
- The index of the object to remove from the collection.
public COSObject set(int i, COSObject object)
i
with object
.
i
- The indexobject
- The object to put at the specified index
public int size()
public boolean isEmpty()
true
if this.size() == 0
.
true
if this.size() == 0
.public COSObject copyDeep(Map copied)
COSObject
The copied
map is used to identify objects copied in
earlier runs of this method to avoid duplicating resources used in
different copy targets (for example the pages of a document).
copied
is modified while executing copyDeep
and contains a mapping from indirect objects in the original document to
copied objects.
The algorithm copies this
along with all outgoing
references (recursively).
Object identity is preserved.
Be careful when copying objects, as there are semantics that may NOT be recognized by this method.
copyDeep
in class COSCompositeObject
COSObject.copyDeep()
public void restoreState(Object object)
restoreState
in interface de.intarsys.tools.component.ISaveStateSupport
restoreState
in class COSObject
public Object saveState()
public COSArray asArray()
COSObject
this
as a COSArray or null
asArray
in class COSObject
null
|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |