nl.knowledgeplaza.util
Class Base64

java.lang.Object
  extended by nl.knowledgeplaza.util.Base64

public class Base64
extends Object

This class contains Base64 encode and decode logic.

Version:
$Revision: 1.3 $
Author:
$Author: toeukpap $
See Also:

Method Summary
static byte[] decode(byte[] in)
          Decodes a byte array from Base64 format.
static byte[] decode(String s)
          Decodes a byte array from Base64 format.
static String decodeString(String s)
          Decodes a string from Base64 format.
static byte[] encode(byte[] in)
          Encodes a byte array into Base64 format.
static byte[] encode(byte[] in, int iLen)
          Encodes a byte array into Base64 format.
static String encodeString(String s)
          Encodes a string into Base64 format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodeString

public static String encodeString(String s)
Encodes a string into Base64 format. No blanks or line breaks are inserted.

Parameters:
s - a String to be encoded.
Returns:
A String with the Base64 encoded data.

encode

public static byte[] encode(byte[] in)
Encodes a byte array into Base64 format. No blanks or line breaks are inserted.

Parameters:
in - an array containing the data bytes to be encoded.
Returns:
A character array with the Base64 encoded data.

encode

public static byte[] encode(byte[] in,
                            int iLen)
Encodes a byte array into Base64 format. No blanks or line breaks are inserted.

Parameters:
in - an array containing the data bytes to be encoded.
iLen - number of bytes to process in in.
Returns:
A character array with the Base64 encoded data.

decodeString

public static String decodeString(String s)
Decodes a string from Base64 format.

Parameters:
s - a Base64 String to be decoded.
Returns:
A String containing the decoded data.
Throws:
IllegalArgumentException - if the input is not valid Base64 encoded data.

decode

public static byte[] decode(String s)
Decodes a byte array from Base64 format.

Parameters:
s - a Base64 String to be decoded.
Returns:
An array containing the decoded data bytes.
Throws:
IllegalArgumentException - if the input is not valid Base64 encoded data.

decode

public static byte[] decode(byte[] in)
Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded data.

Parameters:
in - a character array containing the Base64 encoded data.
Returns:
An array containing the decoded data bytes.
Throws:
IllegalArgumentException - if the input is not valid Base64 encoded data.


Copyright © 2012 KnowledgePlaza. All Rights Reserved.