Package io.fabric8.mockwebserver.http
Class MediaType
- java.lang.Object
-
- io.fabric8.mockwebserver.http.MediaType
-
public class MediaType extends Object
Provides tooling to parse and manipulate media types.Compatibility layer for OkHttp.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringcharset()Returns the charset of this media type, or null if this media type doesn't specify a charset.static MediaTypeget(String mediaType)Returns a media type forstring.static MediaTypeparse(String string)Returns a media type forstring, or null ifstringis not a well-formed media type.Stringsubtype()Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".StringtoString()Stringtype()Returns the high-level media type, such as "text", "image", "audio", "video", or "application".
-
-
-
Method Detail
-
get
public static MediaType get(String mediaType)
Returns a media type forstring.- Throws:
IllegalArgumentException- ifstringis not a well-formed media type.
-
parse
public static MediaType parse(String string)
Returns a media type forstring, or null ifstringis not a well-formed media type.
-
type
public final String type()
Returns the high-level media type, such as "text", "image", "audio", "video", or "application".
-
subtype
public final String subtype()
Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".
-
charset
public final String charset()
Returns the charset of this media type, or null if this media type doesn't specify a charset.
-
-