Package org.apache.batik.ext.awt.color
Class NamedProfileCache
- java.lang.Object
-
- org.apache.batik.util.SoftReferenceCache
-
- org.apache.batik.ext.awt.color.NamedProfileCache
-
public class NamedProfileCache extends SoftReferenceCache
This class manages a cache of soft references to named profiles that we have already loaded.- Version:
- $Id: NamedProfileCache.java 1808001 2017-09-11 09:51:29Z ssteiner $
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static NamedProfileCache
theCache
-
Fields inherited from class org.apache.batik.util.SoftReferenceCache
map
-
-
Constructor Summary
Constructors Constructor Description NamedProfileCache()
Let people create there own caches.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(java.lang.String profileName)
Clear the entry for String.static NamedProfileCache
getDefaultCache()
boolean
isDone(java.lang.String profileName)
Check ifrequest(profileName)
will return immediately with the ICCColorSpaceExt.boolean
isPresent(java.lang.String profileName)
Check ifrequest(profileName)
will return with a ICCColorSpaceExt (not putting you on the hook for it).void
put(java.lang.String profileName, org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent bi)
Associate bi with profileName.org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent
request(java.lang.String profileName)
If this returns null then you are now 'on the hook'.-
Methods inherited from class org.apache.batik.util.SoftReferenceCache
clearImpl, flush, isDoneImpl, isPresentImpl, putImpl, requestImpl
-
-
-
-
Field Detail
-
theCache
static NamedProfileCache theCache
-
-
Method Detail
-
getDefaultCache
public static NamedProfileCache getDefaultCache()
-
isPresent
public boolean isPresent(java.lang.String profileName)
Check ifrequest(profileName)
will return with a ICCColorSpaceExt (not putting you on the hook for it). Note that it is possible that this will return true but between this call and the call to request the soft-reference will be cleared. So it is still possible for request to return NULL, just much less likely (you can always call 'clear' in that case).
-
isDone
public boolean isDone(java.lang.String profileName)
Check ifrequest(profileName)
will return immediately with the ICCColorSpaceExt. Note that it is possible that this will return true but between this call and the call to request the soft-reference will be cleared.
-
request
public org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent request(java.lang.String profileName)
If this returns null then you are now 'on the hook'. to put the ICCColorSpaceExt associated with String into the cache.- Parameters:
profileName
- the profile name
-
clear
public void clear(java.lang.String profileName)
Clear the entry for String. This is the easiest way to 'get off the hook'. if you didn't indend to get on it.
-
put
public void put(java.lang.String profileName, org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent bi)
Associate bi with profileName. bi is only referenced through a soft reference so don't rely on the cache to keep it around. If the map no longer contains our profileName it was probably cleared or flushed since we were put on the hook for it, so in that case we will do nothing.
-
-