|
|||||||||
| 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 exeeds 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(String newName,
long newMaxMemorySize)
|
|
| Method Summary | |
|---|---|
void |
clear()
Remove all entries from cache. |
RenderedImage |
createBrokenImage()
Create a broken image using the cache's default dimension. |
void |
dispose()
|
RenderedImage |
get(File imageFile)
|
RenderedImage |
get(File imageFile,
ImageInCacheListener listener)
|
protected Dimension |
getDefaultImageDimension()
|
Dimension |
getDimension(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(File imageFile)
Is the image for imageFile already stored in the cache? |
protected RenderedImage |
obtainImage(File imageFile)
|
protected Dimension |
obtainImageDimension(File imageFile)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImageCache(String newName,
long newMaxMemorySize)
| Method Detail |
|---|
public RenderedImage get(File imageFile)
throws IOException
IOException
public RenderedImage get(File imageFile,
ImageInCacheListener listener)
throws IOException
IOExceptionpublic Dimension getDimension(File imageFile)
public int getEntryCount()
CacheInfo
getEntryCount in interface CacheInfopublic long getMaxSize()
getMaxSize in interface CacheInfopublic long getUsedSize()
getUsedSize in interface CacheInfoprotected Dimension getDefaultImageDimension()
public void clear()
public RenderedImage createBrokenImage()
public void dispose()
public boolean has(File imageFile)
imageFile already stored in the cache?
protected RenderedImage obtainImage(File imageFile)
throws IOException
IOException
protected Dimension obtainImageDimension(File imageFile)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||