|
xmlgraphics-commons 1.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xmlgraphics.image.loader.cache.ImageCache
public class ImageCache
This class provides a cache for images. The main key into the images is the original URI the image was accessed with.
Don't use one ImageCache instance in the context of multiple base URIs because relative URIs would not work correctly anymore.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
logger |
Constructor Summary | |
---|---|
ImageCache()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
Constructor Detail |
---|
public ImageCache()
Method Detail |
---|
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 images
ImageException
- if an error occurs while parsing image data
java.io.IOException
- if an I/O error occurs while loading image datapublic boolean isInvalidURI(java.lang.String uri)
uri
- the image's URI
protected ImageInfo getImageInfo(java.lang.String uri)
uri
- the image's URI
protected 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 image
public Image getImage(java.lang.String uri, ImageFlavor flavor)
uri
- the image's URIflavor
- the requested ImageFlavor for the image
public void putImage(Image img)
img
- the imagepublic void clearCache()
public void doHouseKeeping()
|
xmlgraphics-commons 1.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |