Modifier and Type | Field and Description |
---|---|
static MimeType |
ALL
Public constant mime type that includes all media ranges (i.e.
|
static String |
ALL_VALUE
A String equivalent of
ALL . |
static MimeType |
APPLICATION_ATOM_XML
Public constant mime type for
application/atom+xml . |
static String |
APPLICATION_ATOM_XML_VALUE
A String equivalent of
APPLICATION_ATOM_XML . |
static MimeType |
APPLICATION_FORM_URLENCODED
Public constant mime type for
application/x-www-form-urlencoded . |
static String |
APPLICATION_FORM_URLENCODED_VALUE
A String equivalent of
APPLICATION_FORM_URLENCODED . |
static MimeType |
APPLICATION_JSON
Public constant mime type for
application/json . |
static String |
APPLICATION_JSON_VALUE
A String equivalent of
APPLICATION_JSON . |
static MimeType |
APPLICATION_OCTET_STREAM
Public constant mime type for
application/octet-stream . |
static String |
APPLICATION_OCTET_STREAM_VALUE
A String equivalent of
APPLICATION_OCTET_STREAM . |
static MimeType |
APPLICATION_XHTML_XML
Public constant mime type for
application/xhtml+xml . |
static String |
APPLICATION_XHTML_XML_VALUE
A String equivalent of
APPLICATION_XHTML_XML . |
static MimeType |
APPLICATION_XML
Public constant mime type for
application/xml . |
static String |
APPLICATION_XML_VALUE
A String equivalent of
APPLICATION_XML . |
static MimeType |
IMAGE_GIF
Public constant mime type for
image/gif . |
static String |
IMAGE_GIF_VALUE
A String equivalent of
IMAGE_GIF . |
static MimeType |
IMAGE_JPEG
Public constant mime type for
image/jpeg . |
static String |
IMAGE_JPEG_VALUE
A String equivalent of
IMAGE_JPEG . |
static MimeType |
IMAGE_PNG
Public constant mime type for
image/png . |
static String |
IMAGE_PNG_VALUE
A String equivalent of
IMAGE_PNG . |
static MimeType |
MULTIPART_FORM_DATA
Public constant mime type for
multipart/form-data . |
static String |
MULTIPART_FORM_DATA_VALUE
A String equivalent of
MULTIPART_FORM_DATA . |
static Comparator<MimeType> |
SPECIFICITY_COMPARATOR
Comparator used by
sortBySpecificity(List) . |
static MimeType |
TEXT_HTML
Public constant mime type for
text/html . |
static String |
TEXT_HTML_VALUE
A String equivalent of
TEXT_HTML . |
static MimeType |
TEXT_PLAIN
Public constant mime type for
text/plain . |
static String |
TEXT_PLAIN_VALUE
A String equivalent of
TEXT_PLAIN . |
static MimeType |
TEXT_XML
Public constant mime type for
text/xml . |
static String |
TEXT_XML_VALUE
A String equivalent of
TEXT_XML . |
Constructor and Description |
---|
MimeTypeUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
generateMultipartBoundary()
Generate a random MIME boundary as bytes, often used in multipart mime types.
|
static String |
generateMultipartBoundaryString()
Generate a random MIME boundary as String, often used in multipart mime types.
|
static MimeType |
parseMimeType(String mimeType)
Parse the given String into a single
MimeType . |
static List<MimeType> |
parseMimeTypes(String mimeTypes)
Parse the given, comma-separated string into a list of
MimeType objects. |
static void |
sortBySpecificity(List<MimeType> mimeTypes)
Sorts the given list of
MimeType objects by specificity. |
static String |
toString(Collection<? extends MimeType> mimeTypes)
Return a string representation of the given list of
MimeType objects. |
public static final MimeType ALL
public static final String ALL_VALUE
ALL
.public static final MimeType APPLICATION_ATOM_XML
application/atom+xml
.public static final String APPLICATION_ATOM_XML_VALUE
APPLICATION_ATOM_XML
.public static final MimeType APPLICATION_FORM_URLENCODED
application/x-www-form-urlencoded
.public static final String APPLICATION_FORM_URLENCODED_VALUE
APPLICATION_FORM_URLENCODED
.public static final MimeType APPLICATION_JSON
application/json
.public static final String APPLICATION_JSON_VALUE
APPLICATION_JSON
.public static final MimeType APPLICATION_OCTET_STREAM
application/octet-stream
.public static final String APPLICATION_OCTET_STREAM_VALUE
APPLICATION_OCTET_STREAM
.public static final MimeType APPLICATION_XHTML_XML
application/xhtml+xml
.public static final String APPLICATION_XHTML_XML_VALUE
APPLICATION_XHTML_XML
.public static final MimeType APPLICATION_XML
application/xml
.public static final String APPLICATION_XML_VALUE
APPLICATION_XML
.public static final MimeType IMAGE_GIF
image/gif
.public static final String IMAGE_GIF_VALUE
IMAGE_GIF
.public static final MimeType IMAGE_JPEG
image/jpeg
.public static final String IMAGE_JPEG_VALUE
IMAGE_JPEG
.public static final MimeType IMAGE_PNG
image/png
.public static final String IMAGE_PNG_VALUE
IMAGE_PNG
.public static final MimeType MULTIPART_FORM_DATA
multipart/form-data
.public static final String MULTIPART_FORM_DATA_VALUE
MULTIPART_FORM_DATA
.public static final MimeType TEXT_HTML
text/html
.public static final String TEXT_HTML_VALUE
TEXT_HTML
.public static final MimeType TEXT_PLAIN
text/plain
.public static final String TEXT_PLAIN_VALUE
TEXT_PLAIN
.public static final MimeType TEXT_XML
text/xml
.public static final String TEXT_XML_VALUE
TEXT_XML
.public static final Comparator<MimeType> SPECIFICITY_COMPARATOR
sortBySpecificity(List)
.public static MimeType parseMimeType(String mimeType)
MimeType
.mimeType
- the string to parseInvalidMimeTypeException
- if the string cannot be parsedpublic static List<MimeType> parseMimeTypes(String mimeTypes)
MimeType
objects.mimeTypes
- the string to parseIllegalArgumentException
- if the string cannot be parsedpublic static String toString(Collection<? extends MimeType> mimeTypes)
MimeType
objects.mimeTypes
- the string to parseIllegalArgumentException
- if the String cannot be parsedpublic static void sortBySpecificity(List<MimeType> mimeTypes)
MimeType
objects by specificity.
Given two mime types:
For example:
audio/basic < audio/* < */*
audio/basic;level=1 < audio/basic
audio/basic == text/html
audio/basic == audio/wave
mimeTypes
- the list of mime types to be sortedpublic static byte[] generateMultipartBoundary()
public static String generateMultipartBoundaryString()