public class LocalImageCache extends java.lang.Thread implements ImageRetriever
| Constructor and Description |
|---|
LocalImageCache(java.lang.String name,
int interval,
int maxAge,
ImageRetriever under)
Creates a local image cache that pools its cache directory at interval rates and deletes files older than maxAge.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
get(java.net.URI uri,
int frameNumber,
boolean thumbnail)
Obtain an image by URI.
|
int |
getInterval() |
int |
getMaxAge() |
boolean |
isRunning() |
void |
run() |
void |
setInterval(int interval) |
void |
setMaxAge(int maxAge) |
void |
start() |
void |
terminate()
Stop this cache from checking for old files.
|
protected static java.lang.String |
toFileName(java.lang.String imageUri,
int frameNumber,
boolean thumbnail) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yieldpublic LocalImageCache(java.lang.String name, int interval, int maxAge, ImageRetriever under)
name - the name of the cache directory.interval - the number of seconds to wait between pool cache directory pooling.maxAge - the number of seconds that a file can stay in the cache without being used/read.under - the underlying image retrieverpublic void start()
start in class java.lang.Threadpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void terminate()
public int getInterval()
public void setInterval(int interval)
interval - the interval to setpublic int getMaxAge()
public void setMaxAge(int maxAge)
maxAge - the maxAge to setprotected static java.lang.String toFileName(java.lang.String imageUri, int frameNumber, boolean thumbnail)
public java.io.InputStream get(java.net.URI uri, int frameNumber, boolean thumbnail) throws java.io.IOException
ImageRetrieverget in interface ImageRetrieveruri - the URI to the imageframeNumber - the frame numberthumbnail - whether to retrieve a thumbnail (true) or the image in its original size (false)java.io.IOExceptionpublic boolean isRunning()