intarsys PDF library API

de.intarsys.pdf.cos
Class COSObjectProxy

java.lang.Object
  extended by de.intarsys.pdf.cos.COSDocumentElement
      extended by de.intarsys.pdf.cos.COSObject
          extended by de.intarsys.pdf.cos.COSCompositeObject
              extended by de.intarsys.pdf.cos.COSObjectProxy
All Implemented Interfaces:
ICOSContainer, ICOSExceptionHandler, IAttributeSupport, de.intarsys.tools.component.ISaveStateSupport, Cloneable

public abstract class COSObjectProxy
extends COSCompositeObject
implements Cloneable

A "proxy object" used to intercept the visitor callback from the serializer.


Field Summary
 
Fields inherited from class de.intarsys.pdf.cos.COSObject
CONSTANT_CONTAINER, NULL_CONTAINER, SLOT_CONTAINER
 
Constructor Summary
COSObjectProxy()
          Create a COSObjectProxy
 
Method Summary
 Object accept(ICOSObjectVisitor visitor)
          Accept a visitor object.
 Iterator basicIterator()
          An iterator over contained objects and references.
 COSObject copyDeep(Map copied)
          Make a deep copy of the receiver within the same document.
 COSObject copyShallow()
          Make a copy of the receiver.
 COSObject dereference()
          return the real object. this is needed for polymorphic handling of document elements. at application programming level only COSObject, never COSReference is seen.
 void ended(COSWriter writer)
          Attention: The user must handle encryption by himself.
 int getLength()
          The length within the data stream for the serialization of this.
 COSObject getObject()
          The object represented by this.
 long getPosition()
          The position within the data stream for the serialization of this.
 Iterator iterator()
          An iterator over contained objects.
 void reserveData(int pLength)
          Reserve length bytes for the serialization of this.
 Object saveState()
           
 void setPosition(long position)
          Assign the position within the data stream.
 
Methods inherited from class de.intarsys.pdf.cos.COSCompositeObject
addObjectListener, associate, containable, copyDeep, disassociate, getAttribute, isObjectListenerAvailable, isPrimitive, referenceCount, referenceIndirect, register, removeAttribute, removeObjectListener, restoreStateContainer, saveStateContainer, setAttribute, willChange
 
Methods inherited from class de.intarsys.pdf.cos.COSObject
asArray, asBoolean, asDictionary, asFixed, asInteger, asName, asNull, asNumber, asStream, asString, beConstant, beIndirect, containable, copyOptional, copySubGraph, getContainer, getDoc, getIndirectObject, isDangling, isIndirect, isNull, isNumber, isSwapped, restoreState, stringValue, toString
 
Methods inherited from class de.intarsys.pdf.cos.COSDocumentElement
handleException, isReference
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.intarsys.pdf.cos.ICOSContainer
getDoc
 

Constructor Detail

COSObjectProxy

public COSObjectProxy()
Create a COSObjectProxy

Method Detail

accept

public Object accept(ICOSObjectVisitor visitor)
              throws COSVisitorException
Description copied from class: COSDocumentElement
Accept a visitor object. The receiver selects the correct implementation in the visitor by "double dispatching".

Specified by:
accept in class COSDocumentElement
Parameters:
visitor - The object visiting the receiver.
Returns:
Object An object depending on the visitor semantics.
Throws:
COSVisitorException - An exception depending on the visitor semantics.

basicIterator

public Iterator basicIterator()
Description copied from class: COSObject
An iterator over contained objects and references. The iterator is an empty iterator if this is not a container.

This iterator returns COSDocumentElements, leaving references alone.

Specified by:
basicIterator in class COSObject
Returns:
Iterator over contained objects and references.

copyDeep

public COSObject copyDeep(Map copied)
Description copied from class: COSObject
Make a deep copy of the receiver within the same document. The result is a "PDF semantic" deep copy, implementation artifacts as "attributes" and listeners are NOT copied.

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.

Overrides:
copyDeep in class COSCompositeObject
Returns:
the object copied recursively
See Also:
COSObject.copyDeep()

copyShallow

public COSObject copyShallow()
Description copied from class: COSObject
Make a copy of the receiver.

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.

Overrides:
copyShallow in class COSObject
Returns:
The object copied

dereference

public COSObject dereference()
Description copied from class: COSObject
return the real object. this is needed for polymorphic handling of document elements. at application programming level only COSObject, never COSReference is seen.

Overrides:
dereference in class COSObject
Returns:
de.intarsys.pdf.cos.COSObject

ended

public void ended(COSWriter writer)
           throws IOException
Attention: The user must handle encryption by himself. The COSWriter doesn't handle encryption in this state.

Parameters:
writer -
Throws:
IOException

getLength

public int getLength()
The length within the data stream for the serialization of this.

Returns:
The length within the data stream for the serialization of this.

getObject

public COSObject getObject()
The object represented by this.

Returns:
The object represented by this.

getPosition

public long getPosition()
The position within the data stream for the serialization of this.

Returns:
The position within the data stream for the serialization of this.

iterator

public Iterator iterator()
Description copied from class: COSObject
An iterator over contained objects. The iterator is an empty iterator if this is not a container.

This iterator returns only COSObject instances, references are dereferenced.

Specified by:
iterator in class COSObject
Returns:
Iterator over contained objects.

reserveData

public void reserveData(int pLength)
Reserve length bytes for the serialization of this.

Parameters:
pLength - Number of bytes to be reserved.

saveState

public Object saveState()
Specified by:
saveState in interface de.intarsys.tools.component.ISaveStateSupport

setPosition

public void setPosition(long position)
Assign the position within the data stream.

Parameters:
position - The position within the data stream.

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.