kom.tools.web
Class MimeType
java.lang.Object
|
+--kom.tools.web.MimeType
- public class MimeType
- extends java.lang.Object
Mime Types
Method Summary |
(package private) static void |
()
Initializes the table of icons vs mime types |
static void |
add(java.lang.String ext,
java.lang.String type)
Associates a file type with a mime type. |
static void |
addIcon(java.lang.String icon,
java.lang.String mime)
Associates an icon with a mime type |
static java.lang.String |
getFileType(java.lang.String mimetype)
Tries to associate a file type with a MIME type |
static java.lang.String |
getMimeIcon(java.lang.String mime)
Gets the name of the icon file for this MIME type |
static java.lang.String |
getMimeType(java.lang.String fileName)
Tries to determine the MIME type corresponding to a file name |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
defaultMimeType
public static final java.lang.String defaultMimeType
mimeTypes
public static java.util.Hashtable mimeTypes
defaultMimeIcon
public static final java.lang.String defaultMimeIcon
mimeIcons
public static java.util.Hashtable mimeIcons
MimeType
public MimeType()
static void ()
- Initializes the table of icons vs mime types
addIcon
public static void addIcon(java.lang.String icon,
java.lang.String mime)
- Associates an icon with a mime type
- Parameters:
icon
- The name of the icon filemime
- The MIME type
add
public static void add(java.lang.String ext,
java.lang.String type)
- Associates a file type with a mime type.
- Parameters:
ext
- File type (extension)type
- MIME type
getMimeIcon
public static java.lang.String getMimeIcon(java.lang.String mime)
- Gets the name of the icon file for this MIME type
- Parameters:
mime
- The specified MIME type- Returns:
- Icon file name
getMimeType
public static java.lang.String getMimeType(java.lang.String fileName)
- Tries to determine the MIME type corresponding to a file name
- Parameters:
fileName
- File name string- Returns:
- Derived MIME type string, e g image/gif for *.gif
getFileType
public static java.lang.String getFileType(java.lang.String mimetype)
- Tries to associate a file type with a MIME type
- Parameters:
mimetype
- MIME type ("type/subtype")- Returns:
- File type, like ".gif" for "image/gif"