Top Description Fields Constructors Methods
org.apache.pdfbox.pdfwriter.compress

public Class COSObjectPool

extends Object
Class Inheritance
Imports
org.apache.pdfbox.cos.COSBase, .COSObject, .COSObjectKey, java.util.HashMap, .Map

An instance of this class maps COSBase instances to COSObjectKeys and allows for a bidirectional lookup.
Author
Christian Appl

Field Summary

Modifier and TypeField and Description
private long
private final Map<COSObjectKey, COSBase>
private final Map<COSBase, COSObjectKey>

Constructor Summary

AccessConstructor and Description
public
COSObjectPool(long
The highest known object number.
highestXRefObjectNumber
)

Creates a map of COSBase instances to COSObjectKeys, allowing bidirectional lookups.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True, if a COSBase is registered for the given COSObjectKey.
contains
(COSObjectKey
The COSObjectKey that shall be checked for a registered COSBase.
key
)

Returns true, if a COSBase is registered for the given COSObjectKey.

public boolean

Returns:

True, if such a COSBase is registered in this pool.
contains
(COSBase
The COSBase that shall be checked.
object
)

Returns true, if the given COSBase is a registered object of this pool.

public long

Returns:

The highest known object number (see: COSObjectKey for further information), that is currently registered in this pool.
getHighestXRefObjectNumber
()

Returns the highest known object number (see: COSObjectKey for further information), that is currently registered in this pool.

public COSObjectKey

Returns:

key The COSObjectKey, that matches the registered COSBase, or null if such an object is not registered.
getKey
(COSBase
The COSBase a COSObjectKey shall be determined for.
object
)

Returns the COSObjectKey for a given registered COSBase.

public COSBase

Returns:

The COSBase, that is registered for the given COSObjectKey, or null if no object is registered for that key.
getObject
(COSObjectKey
The COSObjectKey a registered COSBase shall be found for.
key
)

Returns the COSBase, that is registered for the given COSObjectKey, or null if no object is registered for that key.

public COSObjectKey

Returns:

The actual key, the object has been added for.
put
(COSObjectKey
The key, that shall be added.
key
,
COSBase
The object, that shall be added.
object
)

Update the key and object maps.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

highestXRefObjectNumberback to summary
private long highestXRefObjectNumber
keyPoolback to summary
private final Map<COSObjectKey, COSBase> keyPool
objectPoolback to summary
private final Map<COSBase, COSObjectKey> objectPool

Constructor Detail

COSObjectPoolback to summary
public COSObjectPool(long highestXRefObjectNumber)

Creates a map of COSBase instances to COSObjectKeys, 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:long

The highest known object number.

Method Detail

containsback to summary
public boolean contains(COSObjectKey key)

Returns true, if a COSBase is registered for the given COSObjectKey.

Parameters
key:COSObjectKey

The COSObjectKey that shall be checked for a registered COSBase.

Returns:boolean

True, if a COSBase is registered for the given COSObjectKey.

containsback to summary
public boolean contains(COSBase object)

Returns true, if the given COSBase is a registered object of this pool.

Parameters
object:COSBase

The COSBase that shall be checked.

Returns:boolean

True, if such a COSBase is registered in this pool.

getHighestXRefObjectNumberback to summary
public long getHighestXRefObjectNumber()

Returns the highest known object number (see: COSObjectKey for further information), that is currently registered in this pool.

Returns:long

The highest known object number (see: COSObjectKey for further information), that is currently registered in this pool.

getKeyback to summary
public COSObjectKey getKey(COSBase object)

Returns the COSObjectKey for a given registered COSBase. Returns null if such an object is not registered.

Parameters
object:COSBase

The COSBase a COSObjectKey shall be determined for.

Returns:COSObjectKey

key The COSObjectKey, that matches the registered COSBase, or null if such an object is not registered.

getObjectback to summary
public COSBase getObject(COSObjectKey key)

Returns the COSBase, that is registered for the given COSObjectKey, or null if no object is registered for that key.

Parameters
key:COSObjectKey

The COSObjectKey a registered COSBase shall be found for.

Returns:COSBase

The COSBase, that is registered for the given COSObjectKey, or null if no object is registered for that key.

putback to summary
public COSObjectKey put(COSObjectKey key, COSBase object)

Update the key and object maps.

Parameters
key:COSObjectKey

The key, that shall be added.

object:COSBase

The object, that shall be added.

Returns:COSObjectKey

The actual key, the object has been added for.