public class MediaType extends MessageParser
| Modifier and Type | Field and Description |
|---|---|
static MediaType |
GEMINI |
static MediaType |
GEMTEXT |
static MediaType |
HTML |
static MediaType |
HTML_UTF8 |
static MediaType |
HTTP |
static MediaType |
HTTP_REQUEST |
static MediaType |
HTTP_RESPONSE |
static MediaType |
JSON |
static MediaType |
OCTET_STREAM |
static MediaType |
PLAIN_TEXT |
static MediaType |
WARC_FIELDS |
static MediaType |
WWW_FORM_URLENCODED |
| Modifier and Type | Method and Description |
|---|---|
MediaType |
base()
The base type and subtype without any parameters.
|
boolean |
equals(Object o)
Two media types are considered equal if their type, subtype and parameter names are equal case-insensitively
and if the parameter values are equal case-sensitively.
|
int |
hashCode() |
boolean |
isValid() |
Map<String,String> |
parameters() |
static MediaType |
parse(String string)
Parses a media type string strictly.
|
static MediaType |
parseLeniently(String string)
Parses a media type string leniently.
|
String |
raw()
The original unparsed media type string.
|
String |
subtype() |
String |
toString() |
String |
type() |
emitWarning, getErrorContext, getErrorContextpublic static final MediaType GEMINI
public static final MediaType GEMTEXT
public static final MediaType JSON
public static MediaType HTML
public static MediaType HTML_UTF8
public static MediaType HTTP
public static MediaType HTTP_REQUEST
public static MediaType HTTP_RESPONSE
public static MediaType OCTET_STREAM
public static MediaType PLAIN_TEXT
public static MediaType WARC_FIELDS
public static final MediaType WWW_FORM_URLENCODED
public static MediaType parse(String string) throws IllegalArgumentException
IllegalArgumentException - if the string is not a valid media typepublic static MediaType parseLeniently(String string)
This method is more permissive than parse(String) and will not throw an exception if the string is
invalid. Instead, the returned media type will have isValid() return false. Invalid parameters will be
ignored and will omitted from toString(). The method raw() can be used to return the original
string.
public String raw()
public String type()
public String subtype()
public boolean isValid()
public boolean equals(Object o)
public MediaType base()
Copyright © 2024. All rights reserved.