@Immutable public final class MimeTypeParser extends Object
| Modifier and Type | Method and Description |
|---|---|
static char[] |
getAllTSpecialChars() |
static boolean |
isToken(String sToken)
Check if the passed string is a valid MIME token by checking that the
length is at least 1 and all chars match the
isTokenChar(char)
condition. |
static boolean |
isTokenChar(char c)
Check if the passed character is a valid token character.
|
static boolean |
isTSpecialChar(char c)
Check if the passed character is a special character according to RFC 2045
chapter 5.1
|
static MimeType |
parseMimeType(String sMimeType)
Try to convert the string representation of a MIME type to an object.
|
static MimeType |
parseMimeType(String sMimeType,
EMimeQuoting eQuotingAlgorithm)
Try to convert the string representation of a MIME type to an object.
|
static MimeType |
safeParseMimeType(String sMimeType)
Try to convert the string representation of a MIME type to an object.
|
static MimeType |
safeParseMimeType(String sMimeType,
EMimeQuoting eQuotingAlgorithm)
Try to convert the string representation of a MIME type to an object.
|
@Nonnull @ReturnsMutableCopy public static char[] getAllTSpecialChars()
null.public static boolean isTSpecialChar(char c)
c - The character to checktrue if the character is a special character,
false otherwise.public static boolean isTokenChar(char c)
c - The character to check.true if the passed character is a valid token
character, false otherwisepublic static boolean isToken(@Nullable String sToken)
isTokenChar(char)
condition.sToken - The token to be checked. May be null.true if the passed string is valid token,
false otherwise.@Nullable public static MimeType parseMimeType(@Nullable String sMimeType)
CMimeType.DEFAULT_QUOTING is used to
unquote strings.sMimeType - The string representation to be converted. May be null.null if the parsed string is empty.MimeTypeParserException - In case of an error@Nullable public static MimeType parseMimeType(@Nullable String sMimeType, @Nonnull EMimeQuoting eQuotingAlgorithm)
CMimeType.DEFAULT_QUOTING is used to
un-quote strings.sMimeType - The string representation to be converted. May be null.eQuotingAlgorithm - The quoting algorithm to be used to un-quote parameter values. May
not be null.null if the parsed string is empty.MimeTypeParserException - In case of an error@Nullable public static MimeType safeParseMimeType(@Nullable String sMimeType)
CMimeType.DEFAULT_QUOTING is used to
unquote strings. Compared to parseMimeType(String) this method
swallows all MimeTypeParserException and simply returns
null.sMimeType - The string representation to be converted. May be null.null if the parsed string is empty or not a valid mime
type.@Nullable public static MimeType safeParseMimeType(@Nullable String sMimeType, @Nonnull EMimeQuoting eQuotingAlgorithm)
CMimeType.DEFAULT_QUOTING is used to
un-quote strings. Compared to parseMimeType(String, EMimeQuoting)
this method swallows all MimeTypeParserException and simply returns
null.sMimeType - The string representation to be converted. May be null.eQuotingAlgorithm - The quoting algorithm to be used to un-quote parameter values. May
not be null.null if the parsed string is empty or not a valid mime
type.Copyright © 2014–2019 Philip Helger. All rights reserved.