|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.util.MIMEUtils
public class MIMEUtils
A collection of File, URL and filename
utility methods.
| Constructor Summary | |
|---|---|
MIMEUtils()
|
|
| Method Summary | |
|---|---|
static String |
getDefaultExtension(String type)
Return the default filename extension for a given MIME type. |
static String |
getMIMEType(File file)
Return the MIME type for a given file. |
static String |
getMIMEType(String ext)
Return the MIME type for a given filename extension. |
static void |
loadMimeTypes(Reader in,
Map extMap,
Map mimeMap)
Parses a mime.types file, and generates mappings between
MIME types and extensions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MIMEUtils()
| Method Detail |
|---|
public static String getMIMEType(File file)
throws FileNotFoundException,
IOException
file - File.
FileNotFoundException
IOExceptionpublic static String getMIMEType(String ext)
ext - Filename extension.
public static String getDefaultExtension(String type)
type - MIME type.
public static void loadMimeTypes(Reader in,
Map extMap,
Map mimeMap)
throws IOException
mime.types file, and generates mappings between
MIME types and extensions.
For example, if a line contains:
text/html html htmThen '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.
in - Reader of bytes from mime.types file contentextMap - Empty map of default extensions, keyed by MIME type. Will
be filled in by this method.mimeMap - Empty map of MIME types, keyed by extension. Will be
filled in by this method.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||