eu.beesoft.gaia.util
Class Base64

java.lang.Object
  extended by eu.beesoft.gaia.util.Base64

public class Base64
extends java.lang.Object

A Base64 Encoder/Decoder.

This class is used to encode and decode data in Base64 format as described in RFC 1521.


Method Summary
static byte[] decode(byte[] bytes)
          Decodes given base64 byte array to byte array.
static byte[] decode(byte[] bytes, int offset, int length)
          Decodes given base64 byte array to byte array.
static byte[] decode(char[] chars)
          Decodes given base64 character array to byte array.
static byte[] decode(char[] chars, int offset, int length)
          Decodes given base64 character array to byte array.
static byte[] decode(java.lang.String string)
          Decodes given base64 character string to byte array.
static java.lang.String encode(byte[] bytes)
          Encodes given byte array to base64 character string.
static java.lang.String encode(byte[] bytes, int offset, int length)
          Encodes given byte array to base64 character string.
static byte[] encodeToBytes(byte[] bytes)
          Encodes given byte array to base64 byte array.
static byte[] encodeToBytes(byte[] bytes, int offset, int length)
          Encodes given byte array to base64 byte array.
static char[] encodeToChars(byte[] bytes)
          Encodes given byte array to base64 character array.
static char[] encodeToChars(byte[] bytes, int offset, int length)
          Encodes given byte array to base64 character array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static java.lang.String encode(byte[] bytes)
Encodes given byte array to base64 character string.

Parameters:
bytes - - byte array to encode
Returns:
encoded character string

encode

public static java.lang.String encode(byte[] bytes,
                                      int offset,
                                      int length)
Encodes given byte array to base64 character string.

Parameters:
bytes - - byte array to encode
offset - - offset in byte array with first byte to encode
length - - number of bytes to encode
Returns:
encoded character string

encodeToBytes

public static byte[] encodeToBytes(byte[] bytes)
Encodes given byte array to base64 byte array.

Parameters:
bytes - - byte array to encode
Returns:
encoded byte array

encodeToBytes

public static byte[] encodeToBytes(byte[] bytes,
                                   int offset,
                                   int length)
Encodes given byte array to base64 byte array.

Parameters:
bytes - - byte array to encode
offset - - offset in byte array with first byte to encode
length - - number of bytes to encode
Returns:
encoded byte array

encodeToChars

public static char[] encodeToChars(byte[] bytes)
Encodes given byte array to base64 character array.

Parameters:
bytes - - byte array to encode
Returns:
encoded character array

encodeToChars

public static char[] encodeToChars(byte[] bytes,
                                   int offset,
                                   int length)
Encodes given byte array to base64 character array.

Parameters:
bytes - - byte array to encode
offset - - offset in byte array with first byte to encode
length - - number of bytes to encode
Returns:
encoded character array

decode

public static byte[] decode(java.lang.String string)
Decodes given base64 character string to byte array.

Parameters:
string - - string to decode
Returns:
decoded byte array

decode

public static byte[] decode(byte[] bytes)
Decodes given base64 byte array to byte array.

Parameters:
bytes - - byte array to decode
Returns:
decoded byte array

decode

public static byte[] decode(byte[] bytes,
                            int offset,
                            int length)
Decodes given base64 byte array to byte array.

Parameters:
bytes - - byte array to decode
offset - - offset in byte array with first byte to decode
length - - number of bytes to decode
Returns:
decoded byte array

decode

public static byte[] decode(char[] chars)
Decodes given base64 character array to byte array.

Parameters:
chars - - character array to decode
Returns:
decoded byte array

decode

public static byte[] decode(char[] chars,
                            int offset,
                            int length)
Decodes given base64 character array to byte array.

Parameters:
chars - - character array to decode
offset - - offset in byte array with first byte to decode
length - - number of bytes to decode
Returns:
decoded byte array