Class 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 $
    • 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 if request(profileName) will return immediately with the ICCColorSpaceExt.
      boolean isPresent​(java.lang.String profileName)
      Check if request(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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NamedProfileCache

        public NamedProfileCache()
        Let people create there own caches.
    • Method Detail

      • isPresent

        public boolean isPresent​(java.lang.String profileName)
        Check if request(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 if request(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.