Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel

public Class DefaultResourceCache

extends Object
implements ResourceCache
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.ResourceCache
Imports
java.lang.ref.SoftReference, java.util.HashMap, .Map, org.apache.pdfbox.cos.COSObject, org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList, org.apache.pdfbox.pdmodel.font.PDFont, org.apache.pdfbox.pdmodel.graphics.PDXObject, org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace, org.apache.pdfbox.pdmodel.graphics.pattern.PDAbstractPattern, org.apache.pdfbox.pdmodel.graphics.shading.PDShading, org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState

A resource cached based on SoftReference, retains resources until memory pressure causes them to be garbage collected.
Author
John Hewson

Field Summary

Modifier and TypeField and Description
private final Map<COSObject, SoftReference<PDColorSpace>>
private final Map<COSObject, SoftReference<PDExtendedGraphicsState>>
private final Map<COSObject, SoftReference<PDFont>>
private final Map<COSObject, SoftReference<PDAbstractPattern>>
private final Map<COSObject, SoftReference<PDPropertyList>>
private final Map<COSObject, SoftReference<PDShading>>
private final Map<COSObject, SoftReference<PDXObject>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PDColorSpace
getColorSpace(COSObject
the indirect reference of the colorspace to be returned
indirect
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getColorSpace.

Returns the color space resource for the given indirect object, if it is in the cache.

public PDExtendedGraphicsState
getExtGState(COSObject
the indirect reference of the extended graphics state to be returned
indirect
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getExtGState.

Returns the extended graphics state resource for the given indirect object, if it is in the cache.

public PDFont
getFont(COSObject
the indirect reference of the font to be returned
indirect
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getFont.

Returns the font resource for the given indirect object, if it is in the cache.

public PDAbstractPattern
getPattern(COSObject
the indirect reference of the pattern to be returned
indirect
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getPattern.

Returns the pattern resource for the given indirect object, if it is in the cache.

public PDPropertyList
getProperties(COSObject
the indirect reference of the property list to be returned
indirect
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getProperties.

Returns the property list resource for the given indirect object, if it is in the cache.

public PDShading
getShading(COSObject
the indirect reference of the shading to be returned
indirect
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getShading.

Returns the shading resource for the given indirect object, if it is in the cache.

public PDXObject
getXObject(COSObject
the indirect reference of the XObject to be returned
indirect
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getXObject.

Returns the XObject resource for the given indirect object, if it is in the cache.

public void
put(COSObject
the indirect reference of the font to be cached
indirect
,
PDFont
the font to be cached
font
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect font resource in the cache.

public void
put(COSObject
the indirect reference of the colorspace to be cached
indirect
,
PDColorSpace
the colorspace to be cached
colorSpace
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect color space resource in the cache.

public void
put(COSObject
the indirect reference of the extended graphics state to be cached
indirect
,
PDExtendedGraphicsState
the extended graphics state to be cached
extGState
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect extended graphics state resource in the cache.

public void
put(COSObject
the indirect reference of the shading to be cached
indirect
,
PDShading
the shading to be cached
shading
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect shading resource in the cache.

public void
put(COSObject
the indirect reference of the pattern to be cached
indirect
,
PDAbstractPattern
the pattern to be cached
pattern
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect pattern resource in the cache.

public void
put(COSObject
the indirect reference of the property list to be cached
indirect
,
PDPropertyList
the property list to be cached
propertyList
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect property list resource in the cache.

public void
put(COSObject
the indirect reference of the XObject to be cached
indirect
,
PDXObject
the XObject to be cached
xobject
)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect XObject resource in the cache.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

colorSpacesback to summary
private final Map<COSObject, SoftReference<PDColorSpace>> colorSpaces
extGStatesback to summary
private final Map<COSObject, SoftReference<PDExtendedGraphicsState>> extGStates
fontsback to summary
private final Map<COSObject, SoftReference<PDFont>> fonts
patternsback to summary
private final Map<COSObject, SoftReference<PDAbstractPattern>> patterns
propertiesback to summary
private final Map<COSObject, SoftReference<PDPropertyList>> properties
shadingsback to summary
private final Map<COSObject, SoftReference<PDShading>> shadings
xobjectsback to summary
private final Map<COSObject, SoftReference<PDXObject>> xobjects

Constructor Detail

DefaultResourceCacheback to summary
public DefaultResourceCache()

Method Detail

getColorSpaceback to summary
public PDColorSpace getColorSpace(COSObject indirect)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getColorSpace.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.getColorSpace.

Returns the color space resource for the given indirect object, if it is in the cache.

Parameters
indirect:COSObject

the indirect reference of the colorspace to be returned

Returns:PDColorSpace

the cached instance of the referenced colorspace, if available

Annotations
@Override
getExtGStateback to summary
public PDExtendedGraphicsState getExtGState(COSObject indirect)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getExtGState.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.getExtGState.

Returns the extended graphics state resource for the given indirect object, if it is in the cache.

Parameters
indirect:COSObject

the indirect reference of the extended graphics state to be returned

Returns:PDExtendedGraphicsState

the cached instance of the referenced extended graphics state, if available

Annotations
@Override
getFontback to summary
public PDFont getFont(COSObject indirect)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getFont.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.getFont.

Returns the font resource for the given indirect object, if it is in the cache.

Parameters
indirect:COSObject

the indirect reference of the font to be returned

Returns:PDFont

the cached instance of the referenced font, if available

Annotations
@Override
getPatternback to summary
public PDAbstractPattern getPattern(COSObject indirect)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getPattern.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.getPattern.

Returns the pattern resource for the given indirect object, if it is in the cache.

Parameters
indirect:COSObject

the indirect reference of the pattern to be returned

Returns:PDAbstractPattern

the cached instance of the referenced pattern, if available

Annotations
@Override
getPropertiesback to summary
public PDPropertyList getProperties(COSObject indirect)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getProperties.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.getProperties.

Returns the property list resource for the given indirect object, if it is in the cache.

Parameters
indirect:COSObject

the indirect reference of the property list to be returned

Returns:PDPropertyList

the cached instance of the referenced property list, if available

Annotations
@Override
getShadingback to summary
public PDShading getShading(COSObject indirect)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getShading.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.getShading.

Returns the shading resource for the given indirect object, if it is in the cache.

Parameters
indirect:COSObject

the indirect reference of the shading to be returned

Returns:PDShading

the cached instance of the referenced shading, if available

Annotations
@Override
getXObjectback to summary
public PDXObject getXObject(COSObject indirect)

Implements org.apache.pdfbox.pdmodel.ResourceCache.getXObject.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.getXObject.

Returns the XObject resource for the given indirect object, if it is in the cache.

Parameters
indirect:COSObject

the indirect reference of the XObject to be returned

Returns:PDXObject

the cached instance of the referenced XObject, if available

Annotations
@Override
putback to summary
public void put(COSObject indirect, PDFont font)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect font resource in the cache.

Parameters
indirect:COSObject

the indirect reference of the font to be cached

font:PDFont

the font to be cached

Annotations
@Override
putback to summary
public void put(COSObject indirect, PDColorSpace colorSpace)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect color space resource in the cache.

Parameters
indirect:COSObject

the indirect reference of the colorspace to be cached

colorSpace:PDColorSpace

the colorspace to be cached

Annotations
@Override
putback to summary
public void put(COSObject indirect, PDExtendedGraphicsState extGState)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect extended graphics state resource in the cache.

Parameters
indirect:COSObject

the indirect reference of the extended graphics state to be cached

extGState:PDExtendedGraphicsState

the extended graphics state to be cached

Annotations
@Override
putback to summary
public void put(COSObject indirect, PDShading shading)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect shading resource in the cache.

Parameters
indirect:COSObject

the indirect reference of the shading to be cached

shading:PDShading

the shading to be cached

Annotations
@Override
putback to summary
public void put(COSObject indirect, PDAbstractPattern pattern)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect pattern resource in the cache.

Parameters
indirect:COSObject

the indirect reference of the pattern to be cached

pattern:PDAbstractPattern

the pattern to be cached

Annotations
@Override
putback to summary
public void put(COSObject indirect, PDPropertyList propertyList)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect property list resource in the cache.

Parameters
indirect:COSObject

the indirect reference of the property list to be cached

propertyList:PDPropertyList

the property list to be cached

Annotations
@Override
putback to summary
public void put(COSObject indirect, PDXObject xobject)

Implements org.apache.pdfbox.pdmodel.ResourceCache.put.

Doc from org.apache.pdfbox.pdmodel.ResourceCache.put.

Puts the given indirect XObject resource in the cache.

Parameters
indirect:COSObject

the indirect reference of the XObject to be cached

xobject:PDXObject

the XObject to be cached

Annotations
@Override