Package org.apache.batik.ext.awt.image
Class URLImageCache
java.lang.Object
org.apache.batik.util.SoftReferenceCache
org.apache.batik.ext.awt.image.URLImageCache
This class manages a cache of soft references to Images that
we have already loaded.
Adding an image is two fold. First you add the ParsedURL, this lets the cache know that someone is working on this ParsedURL. Then when the completed RenderedImage is ready you put it into the cache.
If someone requests a ParsedURL after it has been added but before it has been put they will be blocked until the put.
- Version:
- $Id: URLImageCache.java 1808001 2017-09-11 09:51:29Z ssteiner $
-
Field Summary
FieldsFields inherited from class org.apache.batik.util.SoftReferenceCache
map
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear the entry for ParsedURL.static URLImageCache
boolean
Check ifrequest(url)
will return immediately with the Filter.boolean
Check ifrequest(url)
will return with a Filter (not putting you on the hook for it).void
Associate bi with purl.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 Details
-
theCache
-
-
Constructor Details
-
URLImageCache
public URLImageCache()Let people create there own caches.
-
-
Method Details
-
getDefaultCache
-
isPresent
Check ifrequest(url)
will return with a Filter (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
Check ifrequest(url)
will return immediately with the Filter. 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
If this returns null then you are now 'on the hook'. to put the Filter associated with ParsedURL into the cache. -
clear
Clear the entry for ParsedURL. This is the easiest way to 'get off the hook'. if you didn't indend to get on it. -
put
Associate bi with purl. 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 purl it was probably cleared or flushed since we were put on the hook for it, so in that case we will do nothing.
-