|
jPod PDF library | |||||||||
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.COSIndirectObject
public class COSIndirectObject
An object representing an indirect object within a COSDocument.
The indirect object provides transparent lazy access to the serialized
COSObject. Dereferencing this will deserialize the COSObject if not
available. On the other hand, this implementation must support the handling
of very large documents, so transparent garbage collection must be supported.
This is implemented using a two stage reference: A hard reference via
object
is held to objects that should be hard wired in the
memory. A soft reference is held via reference
to objects that
should be available to garbage collection. An object is "hard wired" when one
of the following conditions is true:
You should not override equals or hash without really knowing what you do. Part of the implementation depends 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)
|
static COSIndirectObject |
create(STDocument stDoc,
int objectNumber,
int generationNumber)
|
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. |
boolean |
exists()
|
COSDocument |
getDoc()
The document where this is contained or null. |
int |
getGenerationNumber()
|
COSObjectKey |
getKey()
The key for this. |
int |
getObjectNumber()
|
void |
harden(COSObject pObject)
"Harden" the reference to object , keeping it from being
garbage collected even if (temporarily) not accessed. |
boolean |
isDirty()
true if the object graph referenced by this is changed. |
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 |
setKey(COSObjectKey key)
Assign a COSObjectKey to this. |
void |
setKey(int objectNumber,
int generationNumber)
|
void |
soften(COSObject pObject)
"Soften" the reference to object , making it accessible
for swapping out / garbage collection if the counter for hardening is
zero. |
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 |
---|
public static COSIndirectObject create(COSObject object)
object
- The object that should be indirect.
public static COSIndirectObject create(STDocument stDoc, COSObjectKey key)
public static COSIndirectObject create(STDocument stDoc, int objectNumber, int generationNumber)
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 ICOSContainer associate(ICOSContainer newContainer, COSObject pObject)
ICOSContainer
| composite | indirect |
|
constant | n.a. | n.a. | (always copied before by "containable")
null | ok | ok |
composite | error | ok |
indirect | ok | ok |
associate
in interface ICOSContainer
ICOSContainer
for object
public COSDocumentElement containable()
COSDocumentElement
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.
containable
in class COSDocumentElement
public COSDocumentElement containable(COSObject pObject)
ICOSContainer
containable
in interface ICOSContainer
pObject
- THe object whose containable is requested.
public COSObject dereference()
COSDocumentElement
COSIndirectObject
).
dereference
in class COSDocumentElement
public ICOSContainer disassociate(ICOSContainer oldContainer, COSObject pObject)
ICOSContainer
| composite | indirect | | constant | n.a. | n.a. | null | n.a. | n.a. | composite | ok | n.a. | indirect | ok | n.a. |
disassociate
in interface ICOSContainer
ICOSContainer
for object
public boolean exists()
public COSDocument getDoc()
COSDocumentElement
COSDocumentElement
is at most contained in a single
COSDocument
.
getDoc
in interface ICOSContainer
getDoc
in class COSDocumentElement
public int getGenerationNumber()
public COSObjectKey getKey()
public int getObjectNumber()
public void harden(COSObject pObject)
ICOSContainer
object
, keeping it from being
garbage collected even if (temporarily) not accessed. Otherwise a
container may decide to "swap" its descendants out of memory.
Hardening uses a counter to decide if a strong reference can be finally released.
harden
in interface ICOSContainer
pObject
- The object that should be kept in memory.public boolean isDirty()
true
if the object graph referenced by this is changed.
true
if the object graph referenced by this is
changed.public boolean isReference()
COSDocumentElement
true
if this element is a reference (a
COSIndirectObject
.
isReference
in class COSDocumentElement
true
if this element is a reference.public boolean isSwapped()
COSDocumentElement
true
if this elements content is swapped to a
persistent store.
isSwapped
in class COSDocumentElement
true
if this elements content is swapped to
a persistent store.public int referenceCount()
ICOSContainer
referenceCount
in interface ICOSContainer
public COSIndirectObject referenceIndirect(COSObject pObject)
ICOSContainer
referenceIndirect
in interface ICOSContainer
pObject
- The object to be indirectpublic void register(COSDocumentElement pObject)
ICOSContainer
register
in interface ICOSContainer
pObject
- The new object to be registered in the hierarchy.public void registerWith(STDocument pSTDoc)
pSTDoc
- public ICOSContainer restoreStateContainer(ICOSContainer container)
ICOSContainer
restoreStateContainer
in interface ICOSContainer
public ICOSContainer saveStateContainer()
ICOSContainer
saveStateContainer
in interface ICOSContainer
public void setDirty(boolean pDirty)
public void setKey(COSObjectKey key)
COSObjectKey
to this.
key
- The new key.public void setKey(int objectNumber, int generationNumber)
public void soften(COSObject pObject)
ICOSContainer
object
, making it accessible
for swapping out / garbage collection if the counter for hardening is
zero.
soften
in interface ICOSContainer
pObject
- The object that should be kept in memory.public final STDocument stGetDoc()
public String toString()
toString
in class Object
public void willChange(COSObject change)
ICOSContainer
willChange
in interface ICOSContainer
|
jPod PDF library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |