Crossfire JXClient, Trunk
Public Member Functions | Private Member Functions | Private Attributes | List of all members
com.realtime.crossfire.jxclient.faces.FileCache Class Reference
Inheritance diagram for com.realtime.crossfire.jxclient.faces.FileCache:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.faces.FileCache:
Collaboration graph

Public Member Functions

 FileCache (@NotNull final Path cacheDir)
 
ImageIcon load (@NotNull final Face face)
 
void save (@NotNull final Face face, @NotNull final ImageIcon imageIcon)
 
void save (@NotNull final String faceName, final int faceChecksum, @NotNull final Icon imageIcon)
 

Private Member Functions

Path getImageFileName (@NotNull final String faceName, final int faceChecksum)
 
ImageIcon load (@NotNull final String faceName, final int faceChecksum)
 

Private Attributes

final Path cacheDir
 

Detailed Description

A disk based cache for image files.

Author
Andreas Kirschbaum

Definition at line 40 of file FileCache.java.

Constructor & Destructor Documentation

◆ FileCache()

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

Creates a new instance.

Parameters
cacheDirthe directory where the images are saved

Definition at line 52 of file FileCache.java.

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

Member Function Documentation

◆ getImageFileName()

Path 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 122 of file FileCache.java.

References com.realtime.crossfire.jxclient.faces.FileCache.cacheDir, and 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 63 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 75 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 101 of file FileCache.java.

◆ 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 111 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 Path com.realtime.crossfire.jxclient.faces.FileCache.cacheDir
private

The directory where the images are saved.

Definition at line 46 of file FileCache.java.

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


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