Class FileCache

  • All Implemented Interfaces:
    ImageCache

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

      Constructors 
      Constructor Description
      FileCache​(@NotNull java.nio.file.Path cacheDir)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileCache

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

      • load

        @Nullable
        public @Nullable javax.swing.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 javax.swing.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 java.lang.String faceName,
                         int faceChecksum,
                         @NotNull
                         @NotNull javax.swing.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