org.glite.slcs.util
Class Base64

java.lang.Object
  extended by org.glite.slcs.util.Base64

public class Base64
extends java.lang.Object

Base64 is a wrapper class for the commons-codec apache library.

Version:
$Revision: 1.2 $
Author:
Valery Tschopp

Method Summary
static byte[] byteEncode(byte[] bytes)
          BASE64 encodes the given byte array.
static byte[] decode(byte[] b64Bytes)
          Decodes the given BASE64 encoded byte array.
static byte[] decode(java.lang.String b64)
          Decodes the given BASE64 encoded string.
static java.lang.String encode(byte[] bytes)
          BASE64 encodes the given bytes array.
static java.lang.String encode(byte[] bytes, int blockLength)
          BASE64 encodes the given bytes 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)
BASE64 encodes the given bytes array. 64 chars per line.

Parameters:
bytes - The bytes array to encode BASE64.
Returns:
The BASE64 string.

byteEncode

public static byte[] byteEncode(byte[] bytes)
BASE64 encodes the given byte array.

Parameters:
bytes - The byte array to encode.
Returns:
The BASE64 encoded byte array.

encode

public static java.lang.String encode(byte[] bytes,
                                      int blockLength)
BASE64 encodes the given bytes array.

Parameters:
bytes - The bytes array to encode.
blockLength - The line length of the blocks.
Returns:
The resulting BASE64 string.

decode

public static byte[] decode(java.lang.String b64)
Decodes the given BASE64 encoded string.

Parameters:
b64 - The BASE64 encoded string to decode.
Returns:
The decoded bytes array.

decode

public static byte[] decode(byte[] b64Bytes)
Decodes the given BASE64 encoded byte array.

Parameters:
b64Bytes - The BASE64 encoded byte array to decode.
Returns:
The decoded byte array.