public class FileCache extends java.lang.Object implements ImageCache
Constructor and Description |
---|
FileCache(@NotNull java.nio.file.Path cacheDir)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
@Nullable javax.swing.ImageIcon |
load(@NotNull Face face)
Retrieves an image from the cache.
|
void |
save(@NotNull Face face,
@NotNull javax.swing.ImageIcon imageIcon)
Stores an
ImageIcon into the cache. |
void |
save(@NotNull java.lang.String faceName,
int faceChecksum,
@NotNull javax.swing.Icon imageIcon)
Stores an
ImageIcon into the cache. |
public FileCache(@NotNull @NotNull java.nio.file.Path cacheDir)
cacheDir
- the directory where the images are saved@Nullable public @Nullable javax.swing.ImageIcon load(@NotNull @NotNull Face face)
ImageCache
load
in interface ImageCache
face
- the face to retrievenull
if the cache does not contain the
imagepublic void save(@NotNull @NotNull Face face, @NotNull @NotNull javax.swing.ImageIcon imageIcon)
ImageCache
ImageIcon
into the cache.save
in interface ImageCache
face
- the face to saveimageIcon
- the image icon to storepublic void save(@NotNull @NotNull java.lang.String faceName, int faceChecksum, @NotNull @NotNull javax.swing.Icon imageIcon)
ImageIcon
into the cache.faceName
- the image name to savefaceChecksum
- the checksum to saveimageIcon
- the image icon to store