org.apache.xmlgraphics.image.loader.cache
public class ImageCache extends java.lang.Object
Don't use one ImageCache instance in the context of multiple base URIs because relative URIs would not work correctly anymore.
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
log
logger
|
| Constructor and Description |
|---|
ImageCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Clears the image cache (all ImageInfo and Image objects).
|
void |
doHouseKeeping()
Triggers some house-keeping, i.e.
|
Image |
getImage(ImageInfo info,
ImageFlavor flavor)
Returns an image from the cache or null if it wasn't found.
|
Image |
getImage(java.lang.String uri,
ImageFlavor flavor)
Returns an image from the cache or null if it wasn't found.
|
protected ImageInfo |
getImageInfo(java.lang.String uri)
Returns an ImageInfo instance from the cache or null if none is found.
|
boolean |
isInvalidURI(java.lang.String uri)
Indicates whether a URI has previously been identified as an invalid URI.
|
ImageInfo |
needImageInfo(java.lang.String uri,
ImageSessionContext session,
ImageManager manager)
Returns an ImageInfo instance for a given URI.
|
void |
putImage(Image img)
Registers an image with the cache.
|
protected void |
putImageInfo(ImageInfo info)
Registers an ImageInfo instance with the cache.
|
void |
setCacheListener(ImageCacheListener listener)
Sets an ImageCacheListener instance so the events in the image cache can be observed.
|
public void setCacheListener(ImageCacheListener listener)
listener - the listener instancepublic ImageInfo needImageInfo(java.lang.String uri, ImageSessionContext session, ImageManager manager) throws ImageException, java.io.IOException
uri - the image's URIsession - the session contextmanager - the ImageManager handling the imagesImageException - if an error occurs while parsing image datajava.io.IOException - if an I/O error occurs while loading image datapublic boolean isInvalidURI(java.lang.String uri)
uri - the image's URIprotected ImageInfo getImageInfo(java.lang.String uri)
uri - the image's URIprotected void putImageInfo(ImageInfo info)
info - the ImageInfo instancepublic Image getImage(ImageInfo info, ImageFlavor flavor)
info - the ImageInfo instance representing the imageflavor - the requested ImageFlavor for the imagepublic Image getImage(java.lang.String uri, ImageFlavor flavor)
uri - the image's URIflavor - the requested ImageFlavor for the imagepublic void putImage(Image img)
img - the imagepublic void clearCache()
public void doHouseKeeping()
Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.