|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jomic.tools.ImageCache
public class ImageCache
Cache to store RenderedImages in memory. When the memory usage exceeds a maximum size, the least recent images are removed. Note that the cache holds at least one image, so if this is bigger than the maximum size, so is the whole cache.
Constructor Summary | |
---|---|
ImageCache(java.lang.String newName,
long newMaxMemorySize)
|
Method Summary | |
---|---|
void |
clear()
Remove all entries from cache. |
java.awt.image.RenderedImage |
createBrokenImage()
Create a broken image using the cache's default dimension. |
void |
dispose()
|
java.awt.image.RenderedImage |
get(java.io.File imageFile)
|
java.awt.image.RenderedImage |
get(java.io.File imageFile,
ImageInCacheListener listener)
|
protected java.awt.Dimension |
getDefaultImageDimension()
|
java.awt.Dimension |
getDimension(java.io.File imageFile)
|
int |
getEntryCount()
Number of cache entries. |
long |
getMaxSize()
Get number of bytes the cache may fill up before entries get thrown out. |
long |
getUsedSize()
Get the approximate number of bytes currently used by all images in the cache. |
boolean |
has(java.io.File imageFile)
Is the image for imageFile already stored in the cache? |
protected java.awt.image.RenderedImage |
obtainImage(java.io.File imageFile)
|
protected java.awt.Dimension |
obtainImageDimension(java.io.File imageFile)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageCache(java.lang.String newName, long newMaxMemorySize)
Method Detail |
---|
public java.awt.image.RenderedImage get(java.io.File imageFile) throws java.io.IOException
java.io.IOException
public java.awt.image.RenderedImage get(java.io.File imageFile, ImageInCacheListener listener) throws java.io.IOException
java.io.IOException
public java.awt.Dimension getDimension(java.io.File imageFile)
public int getEntryCount()
CacheInfo
getEntryCount
in interface CacheInfo
public long getMaxSize()
getMaxSize
in interface CacheInfo
public long getUsedSize()
getUsedSize
in interface CacheInfo
protected java.awt.Dimension getDefaultImageDimension()
public void clear()
public java.awt.image.RenderedImage createBrokenImage()
public void dispose()
public boolean has(java.io.File imageFile)
imageFile
already stored in the cache?
protected java.awt.image.RenderedImage obtainImage(java.io.File imageFile) throws java.io.IOException
java.io.IOException
protected java.awt.Dimension obtainImageDimension(java.io.File imageFile) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |