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 encodedWord, java.lang.String charset)
          Decodes an encoded word 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 byte[] decodeBaseQuotedPrintable(java.lang.String s)
          Decodes a string containing quoted-printable 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 encodedWord, java.lang.String charset)
          Decodes an encoded word encoded with the 'Q' encoding (described in RFC 2047) found in a header field body.
 
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

decodeBaseQuotedPrintable

public static byte[] decodeBaseQuotedPrintable(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 encodedWord,
                                       java.lang.String charset)
                                throws java.io.UnsupportedEncodingException
Decodes an encoded word encoded with the 'B' encoding (described in RFC 2047) found in a header field body.

Parameters:
encodedWord - the encoded word 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 encodedWord,
                                       java.lang.String charset)
                                throws java.io.UnsupportedEncodingException
Decodes an encoded word encoded with the 'Q' encoding (described in RFC 2047) found in a header field body.

Parameters:
encodedWord - the encoded word 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 in have the form =?charset?enc?Encoded word?= 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-2010 The Apache Software Foundation. All Rights Reserved.