public final class MediaType extends java.lang.Object implements java.lang.Comparable<MediaType>, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static MediaType |
APPLICATION_XML |
static MediaType |
APPLICATION_ZIP |
static MediaType |
EMPTY |
static MediaType |
OCTET_STREAM |
static MediaType |
TEXT_HTML |
static MediaType |
TEXT_PLAIN |
Constructor and Description |
---|
MediaType(MediaType type,
java.nio.charset.Charset charset)
Creates a media type by adding the "charset" parameter to a base type.
|
MediaType(MediaType type,
java.util.Map<java.lang.String,java.lang.String> parameters) |
MediaType(MediaType type,
java.lang.String name,
java.lang.String value)
Creates a media type by adding a parameter to a base type.
|
MediaType(java.lang.String type,
java.lang.String subtype) |
MediaType(java.lang.String type,
java.lang.String subtype,
java.util.Map<java.lang.String,java.lang.String> parameters) |
Modifier and Type | Method and Description |
---|---|
static MediaType |
application(java.lang.String type) |
static MediaType |
audio(java.lang.String type) |
int |
compareTo(MediaType that) |
boolean |
equals(java.lang.Object object) |
MediaType |
getBaseType()
Returns the base form of the MediaType, excluding
any parameters, such as "text/plain" for
"text/plain; charset=utf-8"
|
java.util.Map<java.lang.String,java.lang.String> |
getParameters()
Returns an immutable sorted map of the parameters of this media type.
|
java.lang.String |
getSubtype()
Return the Sub-Type of the MediaType,
such as "plain" for "text/plain"
|
java.lang.String |
getType()
Return the Type of the MediaType, such as
"text" for "text/plain"
|
int |
hashCode() |
boolean |
hasParameters()
Checks whether this media type contains parameters.
|
static MediaType |
image(java.lang.String type) |
static MediaType |
parse(java.lang.String string)
Parses the given string to a media type.
|
static java.util.Set<MediaType> |
set(MediaType... types)
Convenience method that returns an unmodifiable set that contains
all the given media types.
|
static java.util.Set<MediaType> |
set(java.lang.String... types)
Convenience method that parses the given media type strings and
returns an unmodifiable set that contains all the parsed types.
|
static MediaType |
text(java.lang.String type) |
java.lang.String |
toString() |
static MediaType |
video(java.lang.String type) |
public static final MediaType OCTET_STREAM
public static final MediaType EMPTY
public static final MediaType TEXT_PLAIN
public static final MediaType TEXT_HTML
public static final MediaType APPLICATION_XML
public static final MediaType APPLICATION_ZIP
public MediaType(java.lang.String type, java.lang.String subtype, java.util.Map<java.lang.String,java.lang.String> parameters)
public MediaType(java.lang.String type, java.lang.String subtype)
public MediaType(MediaType type, java.util.Map<java.lang.String,java.lang.String> parameters)
public MediaType(MediaType type, java.lang.String name, java.lang.String value)
type
- base typename
- parameter namevalue
- parameter valuepublic MediaType(MediaType type, java.nio.charset.Charset charset)
type
- base typecharset
- charset valuepublic static MediaType application(java.lang.String type)
public static MediaType audio(java.lang.String type)
public static MediaType image(java.lang.String type)
public static MediaType text(java.lang.String type)
public static MediaType video(java.lang.String type)
public static java.util.Set<MediaType> set(MediaType... types)
types
- media typespublic static java.util.Set<MediaType> set(java.lang.String... types)
types
- media type stringspublic static MediaType parse(java.lang.String string)
string
- media type string to be parsednull
if parsing failspublic MediaType getBaseType()
public java.lang.String getType()
public java.lang.String getSubtype()
public boolean hasParameters()
true
if this type has one or more parameters,
false
otherwisepublic java.util.Map<java.lang.String,java.lang.String> getParameters()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved