|
BEA Systems, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.beasys.commerce.util.MimeTypeHelper
Utility class to help with Mime Types.
This provides support for determining the MIME type based upon a file path/extension, and determining the extensions for a MIME type.
Upon load, this class will attempt to load in the "mime.types" in the same package as it (as a resource via getResource()). If that fails, an error will be thrown. The "mime.types" file should be of the standard Apache group format and provides information on most public mime types.
| Constructor Summary | |
MimeTypeHelper()
|
|
| Method Summary | |
static java.util.List |
getExtensions(java.lang.String mimeType)
Get the list of extensions for the given mime type. |
static java.lang.String |
getFileExtension(java.lang.String path)
Get the last most extension from a file path. |
static java.lang.String |
getMajor(java.lang.String mimeType)
Get the major portion of a mime type. |
static java.lang.String |
getMimeType(java.io.File file)
Get the mime type for the specified file. |
static java.lang.String |
getMimeType(java.lang.String ext)
Get the mime type for the specified extension. |
static java.lang.String |
getMimeTypeFromPath(java.lang.String path)
Get the mime type for the specified file path. |
static java.lang.String |
getMinor(java.lang.String mimeType)
Get the minor portion of a mime type. |
static java.util.List |
split(java.lang.String str,
java.lang.String seps)
Split a string on a separator and return it as a list. |
static void |
splitInto(java.lang.String str,
java.lang.String seps,
java.util.List l)
Split a string on a separator into the given list |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MimeTypeHelper()
| Method Detail |
public static java.util.List getExtensions(java.lang.String mimeType)
mimeType - the mime type.public static java.lang.String getMimeType(java.lang.String ext)
ext - the file extensions (no . included).public static java.lang.String getMimeTypeFromPath(java.lang.String path)
path - the file path.getMimeType(java.lang.String),
getFileExtension(java.lang.String)public static java.lang.String getFileExtension(java.lang.String path)
This can handle both UNIX and Win32 paths.
path - the file path.public static java.lang.String getMimeType(java.io.File file)
file - the file.getMimeTypeFromPath(java.lang.String)public static java.lang.String getMajor(java.lang.String mimeType)
mimeType - the mime type.public static java.lang.String getMinor(java.lang.String mimeType)
mimeType - the mime type.
public static java.util.List split(java.lang.String str,
java.lang.String seps)
str - the string to split.seps - the separators (as per StringTokenizer).
public static void splitInto(java.lang.String str,
java.lang.String seps,
java.util.List l)
str - the string to split.seps - the separators (as per StringTokenizer).l - the list.
|
BEA Systems, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||