org.apache.james.util.codec
Class Base64

java.lang.Object
  extended by org.apache.james.util.codec.Base64

public class Base64
extends java.lang.Object

Performs simple Base64 encoding and decode suitable for authentication. Note that this is not a general purpose codec.

Version:
This is $Revision: 718010 $

Constructor Summary
Base64()
           
 
Method Summary
static java.io.BufferedReader decode(java.lang.String b64string)
          Decode base64 encoded String
static java.lang.String decodeAsString(java.lang.String b64string)
          Decode base64 encoded String
static java.io.ByteArrayOutputStream encode(java.lang.String plaintext)
          Encode String to base64
static java.lang.String encodeAsString(java.lang.String plaintext)
          Encode String to base64
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64

public Base64()
Method Detail

decode

public static java.io.BufferedReader decode(java.lang.String b64string)
                                     throws javax.mail.MessagingException
Decode base64 encoded String

Parameters:
b64string - base64 String
Returns:
reader the BufferedReader which holds the decoded base64 text
Throws:
javax.mail.MessagingException - get thrown when an error was detected while trying to decode the String

decodeAsString

public static java.lang.String decodeAsString(java.lang.String b64string)
                                       throws java.io.IOException,
                                              javax.mail.MessagingException
Decode base64 encoded String

Parameters:
b64string - base64 Sting
Returns:
returnString the String which holds the docoded base64 text
Throws:
javax.mail.MessagingException - get thrown when an error was detected while trying to decode the String
java.io.IOException - get thrown when I/O error was detected

encode

public static java.io.ByteArrayOutputStream encode(java.lang.String plaintext)
                                            throws java.io.IOException,
                                                   javax.mail.MessagingException
Encode String to base64

Parameters:
plaintext - the plaintext to encode
Returns:
out the ByteArrayOutputStream holding the encoded given text
Throws:
java.io.IOException - get thrown when I/O error was detected
javax.mail.MessagingException - get thrown when an error was detected while trying to encode the String

encodeAsString

public static java.lang.String encodeAsString(java.lang.String plaintext)
                                       throws java.io.IOException,
                                              javax.mail.MessagingException
Encode String to base64

Parameters:
plaintext - the plaintext to decode
Returns:
base64String the encoded String
Throws:
java.io.IOException - get thrown when I/O error was detected
javax.mail.MessagingException - get thrown when an error was detected while trying to encode the String


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.