Class MimeUtility
java.lang.Object
org.apache.commons.fileupload.util.mime.MimeUtility
Utility class to decode MIME texts.
- Since:
- 1.3
-
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.private static final StringTheUS-ASCIIcharset identifier constant. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateHidden constructor, this class must not be instantiated. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecodeText(String text) Decode a string of text obtained from a mail header into its proper form.private static StringdecodeWord(String word) Parse 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
-
US_ASCII_CHARSET
TheUS-ASCIIcharset identifier constant.- See Also:
-
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
-
MimeUtility
private MimeUtility()Hidden constructor, this class must not be instantiated.
-
-
Method Details
-
decodeText
Decode 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
Parse 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 2047UnsupportedEncodingException- 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.
-