Class FileCache

java.lang.Object
com.realtime.crossfire.jxclient.faces.FileCache
All Implemented Interfaces:
ImageCache

public class FileCache extends Object implements ImageCache
A disk based cache for image files.
  • Constructor Details

    • FileCache

      public FileCache(@NotNull @NotNull Path cacheDir)
      Creates a new instance.
      Parameters:
      cacheDir - the directory where the images are saved
  • Method Details

    • load

      @Nullable public @Nullable ImageIcon load(@NotNull @NotNull Face face)
      Description copied from interface: ImageCache
      Retrieves an image from the cache.
      Specified by:
      load in interface ImageCache
      Parameters:
      face - the face to retrieve
      Returns:
      the image icon, or null if the cache does not contain the image
    • save

      public void save(@NotNull @NotNull Face face, @NotNull @NotNull ImageIcon imageIcon)
      Description copied from interface: ImageCache
      Stores an ImageIcon into the cache.
      Specified by:
      save in interface ImageCache
      Parameters:
      face - the face to save
      imageIcon - the image icon to store
    • save

      public void save(@NotNull @NotNull String faceName, int faceChecksum, @NotNull @NotNull Icon imageIcon)
      Stores an ImageIcon into the cache.
      Parameters:
      faceName - the image name to save
      faceChecksum - the checksum to save
      imageIcon - the image icon to store