Modifier and Type | Method and Description |
---|---|
Charset |
charset()
Returns the charset of this media type, or null if this media type doesn't specify a charset.
|
Charset |
charset(Charset defaultValue)
Returns the charset of this media type, or
defaultValue if either this media type
doesn't specify a charset, of it its charset is unsupported by the current runtime. |
boolean |
equals(Object other) |
static MediaType |
get(String string)
Returns a media type for
string . |
int |
hashCode() |
static MediaType |
parse(String string)
Returns a media type for
string , or null if string is not a well-formed media
type. |
String |
subtype()
Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".
|
String |
toString()
Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in a
Content-Type header.
|
String |
type()
Returns the high-level media type, such as "text", "image", "audio", "video", or
"application".
|
public static MediaType get(String string)
string
.IllegalArgumentException
- if string
is not a well-formed media type.@Nullable public static MediaType parse(String string)
string
, or null if string
is not a well-formed media
type.public String type()
public String subtype()
@Nullable public Charset charset()
@Nullable public Charset charset(@Nullable Charset defaultValue)
defaultValue
if either this media type
doesn't specify a charset, of it its charset is unsupported by the current runtime.public String toString()
Copyright © 2019. All rights reserved.