type
MimeType
@Serializable { simple=true }
const class MimeType : Obj
MimeType represents the parsed value of a Content-Type header per RFC 2045 section 5.1.
constructors
fromStr |
Parse from string format. |
---|
methods
charset |
If a charset parameter is specified, then map it to the |
---|---|
equals |
Equality is based on the case insensitive mediaType and subType, and params (keys are case insensitive and values are case sensitive). |
forExt |
Map a case insensitive file extension to a MimeType. |
hash |
Hash code is derived from the mediaType, subType, and params hashes. |
mediaType |
The primary media type always in lowercase |
noParams |
Return an instance with this mediaType and subType, but strip any parameters. |
params |
Additional parameters stored in case-insensitive map. |
parseParams |
Parse a set of attribute-value parameters where the values may be tokens or quoted-strings. |
subType |
The subtype always in lowercase |
toStr |
Encode as a MIME message according to RFC 822. |
Slot Details
charset
Charset charset()
If a charset parameter is specified, then map it to the Charset
instance, otherwise return Charset.utf8
.
equals
forExt
fromStr
hash
virtual override Int hash()
Hash code is derived from the mediaType, subType, and params hashes.
mediaType
noParams
MimeType noParams()
Return an instance with this mediaType and subType, but strip any parameters.
params
parseParams
static [Str:Str]? parseParams(Str s, Bool checked := true)
Parse a set of attribute-value parameters where the values may be tokens or quoted-strings. The resulting map is case insensitive. If invalid format return null or raise ParseErr based on checked flag. Parenthesis comments are not supported. If a value pair is missing "= value", then the value is defaulted to "".
Examples:
a=b; c="d" => ["a":"b", "c"="d"] foo=bar; secure => ["foo":"bar", "secure":""]