Class COSObjectPool
java.lang.Object
org.apache.pdfbox.pdfwriter.compress.COSObjectPool
An instance of this class maps
COSBase instances to COSObjectKeys and allows for a bidirectional
lookup.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate final Map<COSObjectKey, COSBase> private final Map<COSBase, COSObjectKey> -
Constructor Summary
ConstructorsConstructorDescriptionCOSObjectPool(long highestXRefObjectNumber) Creates a map ofCOSBaseinstances toCOSObjectKeys, allowing bidirectional lookups. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true, if the givenCOSBaseis a registered object of this pool.booleancontains(COSObjectKey key) Returns true, if aCOSBaseis registered for the givenCOSObjectKey.longReturns the highest known object number (see:COSObjectKeyfor further information), that is currently registered in this pool.Returns theCOSObjectKeyfor a given registeredCOSBase.getObject(COSObjectKey key) Returns theCOSBase, that is registered for the givenCOSObjectKey, or null if no object is registered for that key.put(COSObjectKey key, COSBase object) Update the key and object maps.
-
Field Details
-
keyPool
-
objectPool
-
highestXRefObjectNumber
private long highestXRefObjectNumber
-
-
Constructor Details
-
COSObjectPool
public COSObjectPool(long highestXRefObjectNumber) Creates a map ofCOSBaseinstances toCOSObjectKeys, allowing bidirectional lookups. This constructor can be used for pre - initialized structures to start the assignment of new object numbers starting from the hereby given offset.- Parameters:
highestXRefObjectNumber- The highest known object number.
-
-
Method Details
-
put
Update the key and object maps.- Parameters:
key- The key, that shall be added.object- The object, that shall be added.- Returns:
- The actual key, the object has been added for.
-
getKey
Returns theCOSObjectKeyfor a given registeredCOSBase. Returns null if such an object is not registered.- Parameters:
object- TheCOSBaseaCOSObjectKeyshall be determined for.- Returns:
- key The
COSObjectKey, that matches the registeredCOSBase, or null if such an object is not registered.
-
contains
Returns true, if aCOSBaseis registered for the givenCOSObjectKey.- Parameters:
key- TheCOSObjectKeythat shall be checked for a registeredCOSBase.- Returns:
- True, if a
COSBaseis registered for the givenCOSObjectKey.
-
getObject
Returns theCOSBase, that is registered for the givenCOSObjectKey, or null if no object is registered for that key.- Parameters:
key- TheCOSObjectKeya registeredCOSBaseshall be found for.- Returns:
- The
COSBase, that is registered for the givenCOSObjectKey, or null if no object is registered for that key.
-
contains
Returns true, if the givenCOSBaseis a registered object of this pool. -
getHighestXRefObjectNumber
public long getHighestXRefObjectNumber()Returns the highest known object number (see:COSObjectKeyfor further information), that is currently registered in this pool.- Returns:
- The highest known object number (see:
COSObjectKeyfor further information), that is currently registered in this pool.
-