org.meshcms.core
Class FileTypes

java.lang.Object
  extended byorg.meshcms.core.FileTypes

public final class FileTypes
extends java.lang.Object

Contains data about file types and extension.


Nested Class Summary
static class FileTypes.TypeInfo
           
 
Field Summary
static java.lang.String DEFAULT_ICON
          Default icon for unknown file types.
static java.lang.String DIR_ICON
          Default icon for folders.
static FileTypes.TypeInfo DIRECTORY
          Denotes a directory.
static java.util.SortedMap EXT_MAP
           
static int HTML_ID
          Id of static HTML files.
static int SERVERSIDE_ID
          Id of server-side HTML files (e.g.
static FileTypes.TypeInfo UNKNOWN
          Denotes an unknown file type.
 
Constructor Summary
FileTypes()
           
 
Method Summary
static java.lang.String getDescription(java.lang.String fileName)
          Returns the description of the type of the file.
static java.lang.String getIconFile(java.lang.String fileName)
          Returns the name of the icon file for the type of the given file.
static boolean isCompressible(java.lang.String fileName)
          Returns true if the file is supposed to be compressible.
static boolean isLike(java.lang.String fileName, java.lang.String extension)
          Returns true if the type of the file is the same as the given extension.
static boolean isPage(java.lang.String fileName)
          Returns true if the file is a page (static or server-side).
static boolean isPreventHotlinking(java.lang.String fileName)
          Returns true if the file should be referred from a page to be accessed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXT_MAP

public static final java.util.SortedMap EXT_MAP

DEFAULT_ICON

public static final java.lang.String DEFAULT_ICON
Default icon for unknown file types.

See Also:
Constant Field Values

DIR_ICON

public static final java.lang.String DIR_ICON
Default icon for folders.

See Also:
Constant Field Values

UNKNOWN

public static final FileTypes.TypeInfo UNKNOWN
Denotes an unknown file type.


DIRECTORY

public static final FileTypes.TypeInfo DIRECTORY
Denotes a directory.


HTML_ID

public static final int HTML_ID
Id of static HTML files.

See Also:
Constant Field Values

SERVERSIDE_ID

public static final int SERVERSIDE_ID
Id of server-side HTML files (e.g. JSPs).

See Also:
Constant Field Values
Constructor Detail

FileTypes

public FileTypes()
Method Detail

isLike

public static boolean isLike(java.lang.String fileName,
                             java.lang.String extension)
Returns true if the type of the file is the same as the given extension. For example, isLike("button.gif", "jpg") returns true since gif and jpg are both images.


getDescription

public static java.lang.String getDescription(java.lang.String fileName)
Returns the description of the type of the file.


getIconFile

public static java.lang.String getIconFile(java.lang.String fileName)
Returns the name of the icon file for the type of the given file.


isCompressible

public static boolean isCompressible(java.lang.String fileName)
Returns true if the file is supposed to be compressible. For example, text files are compressible, while ZIP files are not.


isPreventHotlinking

public static boolean isPreventHotlinking(java.lang.String fileName)
Returns true if the file should be referred from a page to be accessed.


isPage

public static boolean isPage(java.lang.String fileName)
Returns true if the file is a page (static or server-side).