public class MimeTypeMapper
extends java.lang.Object
implements java.net.FileNameMap
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String[][] |
mimeDefs
Array of mappings between mime types and file extensions.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
mimeTypes
Map between mime types and file extensions.
|
Constructor and Description |
---|
MimeTypeMapper()
Null args constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentTypeFor(java.lang.String fileName)
Returns MIME type for a filename.
|
static java.lang.String[] |
getMatchingExtensions(java.lang.String mainMimeType)
Returns list of extensions matching main MIME type.
|
protected static final java.lang.String[][] mimeDefs
The first entry is the mime type, the second is the corresponding extension. Some mime types are associated with more then one extension.
protected static java.util.Map<java.lang.String,java.lang.String> mimeTypes
public java.lang.String getContentTypeFor(java.lang.String fileName)
getContentTypeFor
in interface java.net.FileNameMap
fileName
- Name of file for which mime type is desired.When the file name's extension is not found in the mime types hash table, a mime type of "application/octet-stream" is returned.
public static java.lang.String[] getMatchingExtensions(java.lang.String mainMimeType)
mainMimeType
- The main mime type, e.g., "audio".