public class PictureCache
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Vector |
cacheLoadsInProgress
This Vector keeps track of which pictures the PictureCache has been
requested to load in the background.
|
Constructor and Description |
---|
PictureCache() |
Modifier and Type | Method and Description |
---|---|
static void |
add(java.net.URL url,
SourcePicture sp)
store an image in the cache
|
static void |
clear()
clears out all images in the cache.
|
static SourcePicture |
getSourcePicture(java.net.URL url)
returns a picture from the cache.
|
static boolean |
isInCache(java.lang.String urlString)
returns whether an image is in the cache.
|
static boolean |
isInCache(java.net.URL url)
returns whether an image is in the cache.
|
static void |
remove(java.lang.String urlString)
remove a picture from the cache
|
static void |
removeLeastPopular()
this method removes the least popular picture(s) in the cache.
|
static void |
reportCache()
method to inspect the cache
|
static void |
stopBackgroundLoading()
method to stop all background loading
|
static boolean |
stopBackgroundLoadingExcept(java.net.URL exemptionURL)
method to stop all background loading except the indicated file.
|
public static java.util.Vector cacheLoadsInProgress
public static void removeLeastPopular()
public static boolean isInCache(java.net.URL url)
public static boolean isInCache(java.lang.String urlString)
public static void add(java.net.URL url, SourcePicture sp)
url
- The URL of the picturesp
- The picture to be storedpublic static void remove(java.lang.String urlString)
public static SourcePicture getSourcePicture(java.net.URL url)
url
- The URL of the picture to be retrievedpublic static void clear()
public static void reportCache()
public static void stopBackgroundLoading()
public static boolean stopBackgroundLoadingExcept(java.net.URL exemptionURL)