dfischer.femtowebserver.lib
Class Base64Encoder

java.lang.Object
  |
  +--dfischer.femtowebserver.lib.Base64Encoder

public class Base64Encoder
extends java.lang.Object

Converts data to a base64 transformed string.

Usually one of the methods encode() must be used. However if you plan to pack some data to a value of a HTTP CGI parameter, one of the methods encodeForCGI() should be used. encodeForCGI() does the same job like encode(), but after the base64 transformation has been done, some result chars of the base64 string will be replaced:

This additional functionality of encodeForCGI() guarantees, that the converted value will not affect other CGI parameters.

See Also:
Base64Decoder

Method Summary
static java.lang.String encode(byte[] b)
          Converts a byte[] array to a base64 transformed string.
static java.lang.String encode(java.lang.String s)
          Converts a string to a base64 transformed string.
static java.lang.String encodeForCGI(byte[] b)
          Converts a byte[] array to a special, non standard base64 CGI format.
static java.lang.String encodeForCGI(java.lang.String s)
          Converts a string to a special, non standard base64 CGI format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static java.lang.String encode(java.lang.String s)
Converts a string to a base64 transformed string.
Parameters:
s - input string to convert
Returns:
base64 transformed string

encode

public static java.lang.String encode(byte[] b)
Converts a byte[] array to a base64 transformed string.
Parameters:
b - byte[] array to convert
Returns:
base64 transformed string

encodeForCGI

public static java.lang.String encodeForCGI(java.lang.String s)
Converts a string to a special, non standard base64 CGI format.
Parameters:
s - input string to convert
Returns:
special, non standard base64 CGI transformed string

encodeForCGI

public static java.lang.String encodeForCGI(byte[] b)
Converts a byte[] array to a special, non standard base64 CGI format.
Parameters:
b - byte[] array to convert
Returns:
special, non standard base64 CGI transformed string