java.lang.Objectcom.realtime.crossfire.jxclient.faces.FileCache
public class FileCache
A disk based cache for image files.
| Field Summary | |
|---|---|
private java.io.File |
cacheDir
The directory where the images are saved. |
| Constructor Summary | |
|---|---|
FileCache(java.io.File cacheDir)
Creates a new instance. |
|
| Method Summary | |
|---|---|
private java.io.File |
getImageFileName(java.lang.String faceName,
int faceChecksum)
Calculates a hashed image name to be used as a file name. |
javax.swing.ImageIcon |
load(Face face)
Retrieves an image from the cache. |
private javax.swing.ImageIcon |
load(java.lang.String faceName,
int faceChecksum)
Retrieves an image from the cache. |
void |
save(Face face,
javax.swing.ImageIcon imageIcon)
Stores an ImageIcon into the cache. |
void |
save(java.lang.String faceName,
int faceChecksum,
javax.swing.Icon imageIcon)
Stores an ImageIcon into the cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@NotNull private final java.io.File cacheDir
| Constructor Detail |
|---|
public FileCache(@NotNull
java.io.File cacheDir)
cacheDir - the directory where the images are saved| Method Detail |
|---|
@NotNull
private java.io.File getImageFileName(@NotNull
java.lang.String faceName,
int faceChecksum)
faceName - the image name to hashfaceChecksum - the checksum to hash
@Nullable
public javax.swing.ImageIcon load(@NotNull
Face face)
load in interface ImageCacheface - the face to retrieve
null if the cache does not
contain the image
@Nullable
private javax.swing.ImageIcon load(@NotNull
java.lang.String faceName,
int faceChecksum)
faceName - the image name to retrievefaceChecksum - the checksum to retrieve
null if the cache does not
contain the image
public void save(@NotNull
Face face,
@NotNull
javax.swing.ImageIcon imageIcon)
ImageIcon into the cache.
save in interface ImageCacheface - the face to saveimageIcon - the image icon to store
public void save(@NotNull
java.lang.String faceName,
int faceChecksum,
@NotNull
javax.swing.Icon imageIcon)
ImageIcon into the cache.
faceName - the image name to savefaceChecksum - the checksum to saveimageIcon - the image icon to store