Class MimeUtils
java.lang.Object
org.apache.commons.fileupload2.core.MimeUtils
Utility class to decode MIME texts.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringThe marker to indicate text is encoded with BASE64 algorithm.private static final StringIf the text contains any encoded tokens, those tokens will terminate with "=?".private static final StringIf the text contains any encoded tokens, those tokens will be marked with "=?".private static final StringThe linear whitespace chars sequence.Mappings between MIME and Java charset.private static final StringThe marker to indicate text is encoded with QuotedPrintable algorithm. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateHidden constructor, this class must not be instantiated. -
Method Summary
Modifier and TypeMethodDescription(package private) static StringdecodeText(String text) Decodes a string of text obtained from a mail header into its proper form.private static StringdecodeWord(String word) Decodes a string using the RFC 2047 rules for an "encoded-word" type.private static StringjavaCharset(String charset) Translate a MIME standard character set name into the Java equivalent.
-
Field Details
-
BASE64_ENCODING_MARKER
The marker to indicate text is encoded with BASE64 algorithm.- See Also:
-
QUOTEDPRINTABLE_ENCODING_MARKER
The marker to indicate text is encoded with QuotedPrintable algorithm.- See Also:
-
ENCODED_TOKEN_MARKER
If the text contains any encoded tokens, those tokens will be marked with "=?".- See Also:
-
ENCODED_TOKEN_FINISHER
If the text contains any encoded tokens, those tokens will terminate with "=?".- See Also:
-
LINEAR_WHITESPACE
The linear whitespace chars sequence.- See Also:
-
MIME2JAVA
Mappings between MIME and Java charset.
-
-
Constructor Details
-
MimeUtils
private MimeUtils()Hidden constructor, this class must not be instantiated.
-
-
Method Details
-
decodeText
Decodes a string of text obtained from a mail header into its proper form. The text generally will consist of a string of tokens, some of which may be encoded using base64 encoding.- Parameters:
text- The text to decode.- Returns:
- The decoded text string.
- Throws:
UnsupportedEncodingException- if the detected encoding in the input text is not supported.
-
decodeWord
Decodes a string using the RFC 2047 rules for an "encoded-word" type. This encoding has the syntax: encoded-word = "=?" charset "?" encoding "?" encoded-text "?="- Parameters:
word- The possibly encoded word value.- Returns:
- The decoded word.
- Throws:
ParseException- in case of a parse error of the RFC 2047.UnsupportedEncodingException- Thrown when Invalid RFC 2047 encoding was found.
-
javaCharset
Translate a MIME standard character set name into the Java equivalent.- Parameters:
charset- The MIME standard name.- Returns:
- The Java equivalent for this name.
-