com.realtime.crossfire.jxclient.settings
Class Filenames

java.lang.Object
  extended by com.realtime.crossfire.jxclient.settings.Filenames

public class Filenames
extends java.lang.Object

Utility class to return references to settings files.


Constructor Summary
private Filenames()
          Private constructor to prevent instantiation.
 
Method Summary
private static java.lang.String encode(java.lang.CharSequence str)
          Encode a string to make it safe as a file name.
private static java.io.File getCrossfireFile()
          Return the crossfire settings directory.
static java.io.File getDialogsFile(java.lang.String skinName)
          Return the file for storing dialog related information for a skin.
static java.io.File getKeybindingsFile(java.lang.CharSequence hostname, java.lang.CharSequence character)
          Return the keybindings file.
static java.io.File getMagicMapImageCacheDir()
          Return the image cache directory for magic map sized images.
static java.io.File getMetaserverCacheFile()
          Return the metaserver cache file.
static java.io.File getOriginalImageCacheDir()
          Return the image cache directory.
static java.io.File getScaledImageCacheDir()
          Return the image cache directory for double size images.
static java.io.File getSettingsFile()
          Return the main settings file.
static java.io.File getSettingsFile(java.lang.String filename)
          Return a file within the settings directory.
static java.io.File getShortcutsFile(java.lang.CharSequence hostname, java.lang.CharSequence character)
          Return the shortcuts file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filenames

private Filenames()
Private constructor to prevent instantiation.

Method Detail

encode

@NotNull
private static java.lang.String encode(@NotNull
                                               java.lang.CharSequence str)
Encode a string to make it safe as a file name.

Parameters:
str - The string to encode.
Returns:
The encoded string.

getCrossfireFile

@NotNull
private static java.io.File getCrossfireFile()
                                      throws java.io.IOException
Return the crossfire settings directory.

Returns:
The settings directory.
Throws:
java.io.IOException - If the settings directory cannot be located.

getDialogsFile

@NotNull
public static java.io.File getDialogsFile(@NotNull
                                                  java.lang.String skinName)
                                   throws java.io.IOException
Return the file for storing dialog related information for a skin.

Parameters:
skinName - Identifies the skin.
Returns:
The file.
Throws:
java.io.IOException - If the file cannot be accessed.

getKeybindingsFile

@Nullable
public static java.io.File getKeybindingsFile(@Nullable
                                                       java.lang.CharSequence hostname,
                                                       @Nullable
                                                       java.lang.CharSequence character)
Return the keybindings file.

Parameters:
hostname - The hostname of the character; null=global key bindings file.
character - The character name; null=global key bindings file.
Returns:
The keybindings file; return null if the file cannot be accessed.

getMagicMapImageCacheDir

@NotNull
public static java.io.File getMagicMapImageCacheDir()
Return the image cache directory for magic map sized images.

Returns:
The image cache directory.

getMetaserverCacheFile

@Nullable
public static java.io.File getMetaserverCacheFile()
Return the metaserver cache file.

Returns:
The metaserver cache file, or null if the file cannot be accessed.

getOriginalImageCacheDir

@NotNull
public static java.io.File getOriginalImageCacheDir()
Return the image cache directory.

Returns:
The image cache directory.

getScaledImageCacheDir

@NotNull
public static java.io.File getScaledImageCacheDir()
Return the image cache directory for double size images.

Returns:
The image cache directory.

getSettingsFile

@NotNull
public static java.io.File getSettingsFile()
                                    throws java.io.IOException
Return the main settings file.

Returns:
The main settings file.
Throws:
java.io.IOException - If the file cannot be accessed.

getSettingsFile

@NotNull
public static java.io.File getSettingsFile(@NotNull
                                                   java.lang.String filename)
                                    throws java.io.IOException
Return a file within the settings directory.

Parameters:
filename - The filename.
Returns:
The settings file.
Throws:
java.io.IOException - If the file cannot be accessed.

getShortcutsFile

@NotNull
public static java.io.File getShortcutsFile(@NotNull
                                                    java.lang.CharSequence hostname,
                                                    @NotNull
                                                    java.lang.CharSequence character)
                                     throws java.io.IOException
Return the shortcuts file.

Parameters:
hostname - The hostname of the character; null=global key bindings file.
character - The character name; null=global key bindings file.
Returns:
The shortcuts file.
Throws:
java.io.IOException - If the file cannot be accessed.