one.net
Class MimeTypes
java.lang.Object
|
+--one.net.MimeTypes
- All Implemented Interfaces:
- NetConstants
- public final class MimeTypes
- extends Object
- implements NetConstants
Implementation of a mapping between MIME types and file name
extensions.
The mapping used by this class is initialized through a
configuration file. By default, this file is named
"mime.config" and must be located in the current
working directory. Though, the "mime.config.name"
system property can be used to specify an alternative name and
directory. The configuration file contains a line for each MIME
type, which first specifies the MIME type followed by a list of one
or more file name extensions. All file name extensions map to the
specified MIME type; though, the MIME type only maps to the first
file name extension. Empty lines or lines starting with a hash mark
('#') are treated as comments.
- Version:
- $Revision: 1.3 $
| Fields inherited from interface one.net.NetConstants |
CHAR_BACKSPACE, CHAR_BELL, CHAR_DELETE, CHAR_ESCAPE, CHAR_SPACE, CRLF, ENCODING_ASCII, ENCODING_UTF8, EXTENSION_BTUPLE, EXTENSION_CLASS, EXTENSION_DEFAULT, EXTENSION_TUPLE, MIME_TYPE_BTUPLE, MIME_TYPE_CLASS, MIME_TYPE_DEFAULT, MIME_TYPE_TUPLE, PORT_TELNET |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getMimeType
public static String getMimeType(String extension)
- Get the MIME type for the specified file name extension. This
method returns the appropriate MIME type for the specified file
name extension. If no explicit mapping is specified in the
configuration file for this class, this method returns
NetConstants.MIME_TYPE_DEFAULT.
- Parameters:
extension - The file name extension.- Returns:
- The corresponding MIME type.
getExtension
public static String getExtension(String mimeType)
- Get the file name extension for the specified MIME type. This
method returns the appropriate file name extension for the
specified MIME type. If no explicit mapping is specified in the
configuration file for this class, this method returns
NetConstants.EXTENSION_DEFAULT.
- Parameters:
mimeType - The MIME type.- Returns:
- The corresponding file name extension.
(C) Copyright 2001 UW CSE