org.apache.james.mime4j.codec
Class DecoderUtil

java.lang.Object
  extended by org.apache.james.mime4j.codec.DecoderUtil

public class DecoderUtil
extends java.lang.Object

Static methods for decoding strings, byte arrays and encoded words.


Constructor Summary
DecoderUtil()
           
 
Method Summary
static java.lang.String decodeB(java.lang.String encodedText, java.lang.String charset)
          Decodes an encoded text encoded with the 'B' encoding (described in RFC 2047) found in a header field body.
static byte[] decodeBase64(java.lang.String s)
          Decodes a string containing base64 encoded data.
static java.lang.String decodeEncodedWords(java.lang.String body)
          Decodes a string containing encoded words as defined by RFC 2047.
static java.lang.String decodeQ(java.lang.String encodedText, java.lang.String charset)
          Decodes an encoded text encoded with the 'Q' encoding (described in RFC 2047) found in a header field body.
static byte[] decodeQuotedPrintable(java.lang.String s)
          Decodes a string containing quoted-printable encoded data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecoderUtil

public DecoderUtil()
Method Detail

decodeQuotedPrintable

public static byte[] decodeQuotedPrintable(java.lang.String s)
Decodes a string containing quoted-printable encoded data.

Parameters:
s - the string to decode.
Returns:
the decoded bytes.

decodeBase64

public static byte[] decodeBase64(java.lang.String s)
Decodes a string containing base64 encoded data.

Parameters:
s - the string to decode.
Returns:
the decoded bytes.

decodeB

public static java.lang.String decodeB(java.lang.String encodedText,
                                       java.lang.String charset)
                                throws java.io.UnsupportedEncodingException
Decodes an encoded text encoded with the 'B' encoding (described in RFC 2047) found in a header field body.

Parameters:
encodedText - the encoded text to decode.
charset - the Java charset to use.
Returns:
the decoded string.
Throws:
java.io.UnsupportedEncodingException - if the given Java charset isn't supported.

decodeQ

public static java.lang.String decodeQ(java.lang.String encodedText,
                                       java.lang.String charset)
                                throws java.io.UnsupportedEncodingException
Decodes an encoded text encoded with the 'Q' encoding (described in RFC 2047) found in a header field body.

Parameters:
encodedText - the encoded text to decode.
charset - the Java charset to use.
Returns:
the decoded string.
Throws:
java.io.UnsupportedEncodingException - if the given Java charset isn't supported.

decodeEncodedWords

public static java.lang.String decodeEncodedWords(java.lang.String body)
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 decode.
Returns:
the decoded string.


Copyright © 2004-2013. All Rights Reserved.