Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.faces.FileCache Class Reference

A disk based cache for image files. More...

+ Inheritance diagram for com.realtime.crossfire.jxclient.faces.FileCache:
+ Collaboration diagram for com.realtime.crossfire.jxclient.faces.FileCache:

Public Member Functions

 FileCache (@NotNull final File cacheDir)
 Creates a new instance. More...
 
ImageIcon load (@NotNull final Face face)
 Retrieves an image from the cache.
Parameters
facethe face to retrieve
Returns
the image icon, or
null
if the cache does not contain the image
More...
 
void save (@NotNull final Face face, @NotNull final ImageIcon imageIcon)
 Stores an ImageIcon into the cache.
Parameters
facethe face to save
imageIconthe image icon to store
More...
 
void save (@NotNull final String faceName, final int faceChecksum, @NotNull final Icon imageIcon)
 Stores an ImageIcon into the cache. More...
 

Private Member Functions

File getImageFileName (@NotNull final String faceName, final int faceChecksum)
 Calculates a hashed image name to be used as a file name. More...
 
ImageIcon load (@NotNull final String faceName, final int faceChecksum)
 Retrieves an image from the cache. More...
 

Private Attributes

final File cacheDir
 The directory where the images are saved. More...
 

Detailed Description

A disk based cache for image files.

Author
Andreas Kirschbaum

Definition at line 38 of file FileCache.java.

Constructor & Destructor Documentation

◆ FileCache()

com.realtime.crossfire.jxclient.faces.FileCache.FileCache ( @NotNull final File  cacheDir)

Creates a new instance.

Parameters
cacheDirthe directory where the images are saved

Definition at line 50 of file FileCache.java.

References com.realtime.crossfire.jxclient.faces.FileCache.cacheDir.

Member Function Documentation

◆ getImageFileName()

File com.realtime.crossfire.jxclient.faces.FileCache.getImageFileName ( @NotNull final String  faceName,
final int  faceChecksum 
)
private

Calculates a hashed image name to be used as a file name.

Parameters
faceNamethe image name to hash
faceChecksumthe checksum to hash
Returns
the hashed image name

Definition at line 119 of file FileCache.java.

References com.realtime.crossfire.jxclient.util.FilenameUtils.quoteName().

Referenced by com.realtime.crossfire.jxclient.faces.FileCache.load(), and com.realtime.crossfire.jxclient.faces.FileCache.save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load() [1/2]

ImageIcon com.realtime.crossfire.jxclient.faces.FileCache.load ( @NotNull final Face  face)

Retrieves an image from the cache.

Parameters
facethe face to retrieve
Returns
the image icon, or
null
if the cache does not contain the image

Implements com.realtime.crossfire.jxclient.faces.ImageCache.

Definition at line 62 of file FileCache.java.

◆ load() [2/2]

ImageIcon com.realtime.crossfire.jxclient.faces.FileCache.load ( @NotNull final String  faceName,
final int  faceChecksum 
)
private

Retrieves an image from the cache.

Parameters
faceNamethe image name to retrieve
faceChecksumthe checksum to retrieve
Returns
the image icon, or
null
if the cache does not contain the image

Definition at line 74 of file FileCache.java.

References com.realtime.crossfire.jxclient.faces.FileCache.getImageFileName().

+ Here is the call graph for this function:

◆ save() [1/2]

void com.realtime.crossfire.jxclient.faces.FileCache.save ( @NotNull final Face  face,
@NotNull final ImageIcon  imageIcon 
)

Stores an ImageIcon into the cache.

Parameters
facethe face to save
imageIconthe image icon to store

Implements com.realtime.crossfire.jxclient.faces.ImageCache.

Definition at line 98 of file FileCache.java.

Referenced by com.realtime.crossfire.jxclient.faces.ImageScale2x.main().

+ Here is the caller graph for this function:

◆ save() [2/2]

void com.realtime.crossfire.jxclient.faces.FileCache.save ( @NotNull final String  faceName,
final int  faceChecksum,
@NotNull final Icon  imageIcon 
)

Stores an ImageIcon into the cache.

Parameters
faceNamethe image name to save
faceChecksumthe checksum to save
imageIconthe image icon to store

Definition at line 108 of file FileCache.java.

References com.realtime.crossfire.jxclient.faces.FileCache.getImageFileName(), and com.realtime.crossfire.jxclient.util.Images.saveImageIcon().

+ Here is the call graph for this function:

Member Data Documentation

◆ cacheDir

final File com.realtime.crossfire.jxclient.faces.FileCache.cacheDir
private

The directory where the images are saved.

Definition at line 44 of file FileCache.java.

Referenced by com.realtime.crossfire.jxclient.faces.FileCache.FileCache().


The documentation for this class was generated from the following file: