intarsys PDF library API

de.intarsys.pdf.cos
Class COSIndirectObject

java.lang.Object
  extended by de.intarsys.pdf.cos.COSDocumentElement
      extended by de.intarsys.pdf.cos.COSIndirectObject
All Implemented Interfaces:
ICOSContainer, ICOSExceptionHandler

public class COSIndirectObject
extends COSDocumentElement
implements ICOSContainer

An object representing an indirect object within a COSDocument.

Actually you should not override equals or hash without really knowing what you do. Portions of the implementation depend on indirect objects being real unique.


Method Summary
 Object accept(ICOSObjectVisitor visitor)
          Accept a visitor object.
 ICOSContainer associate(ICOSContainer newContainer, COSObject pObject)
          It is the responsibility of the current container to create the association with the new one.
 COSDocumentElement containable()
          The COSDocumentElement suitable for use in an ICOSContainer.
 COSDocumentElement containable(COSObject pObject)
          The stand-in to be used when object should be contained in a container.
static COSIndirectObject create(COSObject object)
          Create an indirection for object.
static COSIndirectObject create(STDocument stDoc, COSObjectKey key)
           
 COSObject dereference()
          Return the real object.
 ICOSContainer disassociate(ICOSContainer oldContainer, COSObject pObject)
          It is the responsibility of the current container to remove the association from the old one.
 COSDocument getDoc()
          The document where this is contained or null.
 COSObjectKey getKey()
          The key for this.
 COSObject getObject()
          The object represented by this.
 boolean isDirty()
          true if the object graph referenced by this is changed.
 boolean isEncryptOnWrite()
           
 boolean isReference()
          Answer true if this element is a reference (a COSIndirectObject.
 boolean isSwapped()
          Answer true if this elements content is swapped to a persistent store.
 int referenceCount()
          The number of references to the contained object.
 COSIndirectObject referenceIndirect(COSObject pObject)
          Switch a contained object to an indirect one.
 void register(COSDocumentElement pObject)
          It is the responsibility of the active container to register object in its data structures.
 void registerWith(STDocument pSTDoc)
           
 ICOSContainer restoreStateContainer(ICOSContainer container)
          Restore the save state for the container.
 ICOSContainer saveStateContainer()
          Create a save state for the container when saving the COSObject state.
 void setDirty(boolean pDirty)
          Set the dirty state of the indirect object
 void setEncryptOnWrite(boolean encryptOnWrite)
          Flag the referenced object to be encrypted, if the document itself is encrypted.
 void setKey(COSObjectKey key)
          Assign a COSObjectKey to this.
 void setObject(COSObject newObject)
          Set the object for this reference.
 STDocument stGetDoc()
          The ST level document.
 String toString()
           
 void willChange(COSObject change)
          Propagate a change from a COSObject down in the hierarchy.
 
Methods inherited from class de.intarsys.pdf.cos.COSDocumentElement
handleException
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static COSIndirectObject create(STDocument stDoc,
                                       COSObjectKey key)

create

public static COSIndirectObject create(COSObject object)
Create an indirection for object.

Parameters:
object - The object that should be indirect.
Returns:
The new indirect object.

getDoc

public COSDocument getDoc()
Description copied from class: COSDocumentElement
The document where this is contained or null. A COSDocumentElement is at most contained in a single COSDocument.

Specified by:
getDoc in interface ICOSContainer
Specified by:
getDoc in class COSDocumentElement
Returns:
The document where this is contained.

getKey

public COSObjectKey getKey()
The key for this.

Returns:
The key for this.

setObject

public void setObject(COSObject newObject)
Set the object for this reference. The reference is already registered with the document, the object is provided "lazy" by the storage.

Parameters:
newObject - the new object to set

getObject

public COSObject getObject()
The object represented by this.

Returns:
The object represented by this.

isReference

public boolean isReference()
Description copied from class: COSDocumentElement
Answer true if this element is a reference (a COSIndirectObject.

Overrides:
isReference in class COSDocumentElement
Returns:
Answer true if this element is a reference.

willChange

public void willChange(COSObject change)
Description copied from interface: ICOSContainer
Propagate a change from a COSObject down in the hierarchy.

Specified by:
willChange in interface ICOSContainer

setDirty

public void setDirty(boolean pDirty)
Set the dirty state of the indirect object


isDirty

public boolean isDirty()
true if the object graph referenced by this is changed.

Returns:
true if the object graph referenced by this is changed.

dereference

public COSObject dereference()
Description copied from class: COSDocumentElement
Return the real object. This is either the object itself or the object referenced by a reference object (COSIndirectObject).

Specified by:
dereference in class COSDocumentElement
Returns:
The real object.

isSwapped

public boolean isSwapped()
Description copied from class: COSDocumentElement
Answer true if this elements content is swapped to a persistent store.

Overrides:
isSwapped in class COSDocumentElement
Returns:
Answer true if this elements content is swapped to a persistent store.

toString

public String toString()
Overrides:
toString in class Object

register

public void register(COSDocumentElement pObject)
Description copied from interface: ICOSContainer
It is the responsibility of the active container to register object in its data structures.

Specified by:
register in interface ICOSContainer
Parameters:
pObject - The new object to be registered in the hierarchy.

setKey

public void setKey(COSObjectKey key)
Assign a COSObjectKey to this.

Parameters:
key - The new key.

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.

isEncryptOnWrite

public boolean isEncryptOnWrite()
Returns:
true if the referenced object should be encrypted. The default is true;

setEncryptOnWrite

public void setEncryptOnWrite(boolean encryptOnWrite)
Flag the referenced object to be encrypted, if the document itself is encrypted. The default is true.

Parameters:
encryptOnWrite -

stGetDoc

public STDocument stGetDoc()
The ST level document.

Returns:
The ST level document.

registerWith

public void registerWith(STDocument pSTDoc)
Parameters:
pSTDoc -

referenceIndirect

public COSIndirectObject referenceIndirect(COSObject pObject)
Description copied from interface: ICOSContainer
Switch a contained object to an indirect one. Update the reference.

Specified by:
referenceIndirect in interface ICOSContainer
Parameters:
pObject - The object to be indirect

associate

public ICOSContainer associate(ICOSContainer newContainer,
                               COSObject pObject)
Description copied from interface: ICOSContainer
It is the responsibility of the current container to create the association with the new one. The table shows the available transitions | composite | indirect | | constant | n.a. | n.a. | (always copied before by "containable") null | ok | ok | composite | error | ok | indirect | ok | ok |

Specified by:
associate in interface ICOSContainer
Returns:
The resulting ICOSContainer for object

disassociate

public ICOSContainer disassociate(ICOSContainer oldContainer,
                                  COSObject pObject)
Description copied from interface: ICOSContainer
It is the responsibility of the current container to remove the association from the old one. The table shows the available transitions.
              | composite  | indirect   |
              |
    constant  | n.a.       | n.a.       |
    null      | n.a.       | n.a.       |
    composite | ok         | n.a.       |
    indirect  | ok         | n.a.       |
 

Specified by:
disassociate in interface ICOSContainer
Returns:
The resulting ICOSContainer for object

containable

public COSDocumentElement containable()
Description copied from class: COSDocumentElement
The COSDocumentElement suitable for use in an ICOSContainer. This may be a COSIndirectObject or the COSObject itself if not indirect.

This method should not be used by the application programmer. This is called in the COSObject lifecycle to ensure internal consistency.

Specified by:
containable in class COSDocumentElement

containable

public COSDocumentElement containable(COSObject pObject)
Description copied from interface: ICOSContainer
The stand-in to be used when object should be contained in a container. This is either the object itself or the COSIndirectObject to it.

Specified by:
containable in interface ICOSContainer
Parameters:
pObject - THe object whose containable is requested.
Returns:
The stand-in to be used when object should be contained in a container.

referenceCount

public int referenceCount()
Description copied from interface: ICOSContainer
The number of references to the contained object. This method returns -1 when the value can not be determined (as for indirect objects parsed from a file).

Specified by:
referenceCount in interface ICOSContainer
Returns:
The number of references to the contained object.

saveStateContainer

public ICOSContainer saveStateContainer()
Description copied from interface: ICOSContainer
Create a save state for the container when saving the COSObject state.

Specified by:
saveStateContainer in interface ICOSContainer
Returns:
The save state for the container.

restoreStateContainer

public ICOSContainer restoreStateContainer(ICOSContainer container)
Description copied from interface: ICOSContainer
Restore the save state for the container.

Specified by:
restoreStateContainer in interface ICOSContainer
Returns:
The "before" state of the receiver.

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.