Class MediaType
java.lang.Object
org.netpreserve.jwarc.MessageParser
org.netpreserve.jwarc.MediaType
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbase()The base type and subtype without any parameters.booleanTwo 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.inthashCode()booleanisValid()static MediaTypeParses a media type string strictly.static MediaTypeparseLeniently(String string) Parses a media type string leniently.raw()The original unparsed media type string.subtype()toString()type()Methods inherited from class org.netpreserve.jwarc.MessageParser
emitWarning, getErrorContext, getErrorContext
-
Field Details
-
GEMINI
-
GEMTEXT
-
JSON
-
HTML
-
HTML_UTF8
-
HTTP
-
HTTP_REQUEST
-
HTTP_RESPONSE
-
OCTET_STREAM
-
PLAIN_TEXT
-
WARC_FIELDS
-
WWW_FORM_URLENCODED
-
-
Method Details
-
parse
Parses a media type string strictly.- Throws:
IllegalArgumentException- if the string is not a valid media type
-
parseLeniently
Parses a media type string leniently.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 haveisValid()return false. Invalid parameters will be ignored and will omitted fromtoString(). The methodraw()can be used to return the original string. -
raw
The original unparsed media type string. -
type
-
subtype
-
parameters
-
isValid
public boolean isValid() -
equals
-
hashCode
-
toString
-
base
The base type and subtype without any parameters.
-