| java.lang.Object org.apache.cocoon.util.MIMEUtils
Method Summary | |
public static String | getDefaultExtension(String type) Return the default filename extension for a given MIME type.
Parameters: type - MIME type. | public static String | getMIMEType(File file) Return the MIME type for a given file.
Parameters: file - File. | public static String | getMIMEType(String ext) Return the MIME type for a given filename extension.
Parameters: ext - Filename extension. | public static void | loadMimeTypes(Reader in, Map extMap, Map mimeMap) Parses a mime.types file, and generates mappings between
MIME types and extensions.
For example, if a line contains:
text/html html htm
Then 'html' will be the default extension for text/html, and both 'html'
and 'htm' will have MIME type 'text/html'.
Lines starting with '#' are treated as comments and ignored. |
getDefaultExtension | public static String getDefaultExtension(String type)(Code) | | Return the default filename extension for a given MIME type.
Parameters: type - MIME type. Filename extension. |
getMIMEType | public static String getMIMEType(String ext)(Code) | | Return the MIME type for a given filename extension.
Parameters: ext - Filename extension. MIME type. |
loadMimeTypes | public static void loadMimeTypes(Reader in, Map extMap, Map mimeMap) throws IOException(Code) | | Parses a mime.types file, and generates mappings between
MIME types and extensions.
For example, if a line contains:
text/html html htm
Then 'html' will be the default extension for text/html, and both 'html'
and 'htm' will have MIME type 'text/html'.
Lines starting with '#' are treated as comments and ignored. If an
extension is listed for two MIME types, the first will be chosen.
Parameters: in - Reader of bytes from mime.types file content Parameters: extMap - Empty map of default extensions, keyed by MIME type. Willbe filled in by this method. Parameters: mimeMap - Empty map of MIME types, keyed by extension. Will befilled in by this method. |
|
|