public final class Mime extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MIME_APP_JSON
Json Mime type.
|
static String |
MIME_CSS
CSS code MIME type.
|
static String |
MIME_DEFAULT_BINARY
Binary code MIME type.
|
static String |
MIME_FORM_ENCODED_DATA
Form Encoded Data MIME type.
|
static String |
MIME_GIF
GIF files MIME type.
|
static String |
MIME_HTML
HTML code MIME type.
|
static String |
MIME_JPEG
JPEG files MIME type.
|
static String |
MIME_JS
JavaScript code MIME type.
|
static String |
MIME_MULTIPART_FORM_ENCODED_DATA
Multipart Form Encoded Data MIME type.
|
static String |
MIME_PLAINTEXT
Standard text MIME type.
|
static String |
MIME_PNG
PNG files MIME type.
|
static String |
MIME_XML
XML code MIME type.
|
Modifier and Type | Method and Description |
---|---|
static String |
getMIMEType(String uri)
Returns the MIME type from the name of the URI (file extension).
|
static boolean |
mapFileExtensionToMIMEType(String fileExtension,
String mimeType)
Define a mapping between a file extension and a MIME-Type.
The mapping is defined only if the given file extension isn't already mapped to a MIME-Type. |
public static final String MIME_APP_JSON
public static final String MIME_CSS
public static final String MIME_DEFAULT_BINARY
public static final String MIME_FORM_ENCODED_DATA
public static final String MIME_GIF
public static final String MIME_HTML
public static final String MIME_JPEG
public static final String MIME_JS
public static final String MIME_MULTIPART_FORM_ENCODED_DATA
public static final String MIME_PLAINTEXT
public static final String MIME_PNG
public static final String MIME_XML
@Nullable public static String getMIMEType(@Nullable String uri)
uri
- the URI String
to determine the MIME type (mapping between file extension and MIME type)null
if the MIME type is unknown or URI is null
public static boolean mapFileExtensionToMIMEType(String fileExtension, String mimeType)
NullPointerException
is thrown if one of the arguments is null
fileExtension
- the file extension to be mapped to the mimeType
mimeType
- the MIME-Type to be associated with the given file extension.true
if the mapping is successful, false
otherwise (file extension already mapped to a
MIME-Type)