Package org.apache.james.mime4j.codec
Class DecoderUtil
- java.lang.Object
-
- org.apache.james.mime4j.codec.DecoderUtil
-
public class DecoderUtil extends Object
Static methods for decoding strings, byte arrays and encoded words.
-
-
Constructor Summary
Constructors Constructor Description DecoderUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringdecodeEncodedWords(String body, Charset fallback)Decodes a string containing encoded words as defined by RFC 2047.static StringdecodeEncodedWords(String body, DecodeMonitor monitor)Decodes a string containing encoded words as defined by RFC 2047.static StringdecodeEncodedWords(String body, DecodeMonitor monitor, Charset fallback)Decodes a string containing encoded words as defined by RFC 2047.static StringdecodeEncodedWords(String body, DecodeMonitor monitor, Charset fallback, Map<Charset,Charset> charsetOverrides)Decodes a string containing encoded words as defined by RFC 2047.
-
-
-
Method Detail
-
decodeEncodedWords
public static String decodeEncodedWords(String body, DecodeMonitor monitor) throws IllegalArgumentException
Decodes a string containing encoded words as defined by RFC 2047. Encoded words have the form =?charset?enc?encoded-text?= where enc is either 'Q' or 'q' for quoted-printable and 'B' or 'b' for base64.- Parameters:
body- the string to decodemonitor- the DecodeMonitor to be used.- Returns:
- the decoded string.
- Throws:
IllegalArgumentException- only if the DecodeMonitor strategy throws it (Strict parsing)
-
decodeEncodedWords
public static String decodeEncodedWords(String body, Charset fallback) throws IllegalArgumentException
Decodes a string containing encoded words as defined by RFC 2047. Encoded words have the form =?charset?enc?encoded-text?= where enc is either 'Q' or 'q' for quoted-printable and 'B' or 'b' for base64. Using fallback charset if charset in encoded words is invalid.- Parameters:
body- the string to decodefallback- the fallback Charset to be used.- Returns:
- the decoded string.
- Throws:
IllegalArgumentException- only if the DecodeMonitor strategy throws it (Strict parsing)
-
decodeEncodedWords
public static String decodeEncodedWords(String body, DecodeMonitor monitor, Charset fallback) throws IllegalArgumentException
Decodes a string containing encoded words as defined by RFC 2047. Encoded words have the form =?charset?enc?encoded-text?= where enc is either 'Q' or 'q' for quoted-printable and 'B' or 'b' for base64. Using fallback charset if charset in encoded words is invalid.- Parameters:
body- the string to decodemonitor- the DecodeMonitor to be used.fallback- the fallback Charset to be used.- Returns:
- the decoded string.
- Throws:
IllegalArgumentException- only if the DecodeMonitor strategy throws it (Strict parsing)
-
decodeEncodedWords
public static String decodeEncodedWords(String body, DecodeMonitor monitor, Charset fallback, Map<Charset,Charset> charsetOverrides) throws IllegalArgumentException
Decodes a string containing encoded words as defined by RFC 2047. Encoded words have the form =?charset?enc?encoded-text?= where enc is either 'Q' or 'q' for quoted-printable and 'B' or 'b' for base64. Using fallback charset if charset in encoded words is invalid. Additionally, the found charset will be overridden if a corresponding mapping is found.- Parameters:
body- the string to decodemonitor- the DecodeMonitor to be used.fallback- the fallback Charset to be used.charsetOverrides- the Charsets to override and their replacements. Must not be null.- Returns:
- the decoded string.
- Throws:
IllegalArgumentException- only if the DecodeMonitor strategy throws it (Strict parsing)
-
-