com.sap.ip.me.api.services
Class Base64

java.lang.Object
  extended bycom.sap.ip.me.api.services.Base64

public final class Base64
extends java.lang.Object

The class provides methods to transform any string into a standard base64 string and vice versa.

Author:
SAP

Method Summary
static byte[] decode(char[] chars)
          Decodes a character array which is standard Base64 complient into the corresponding byte array representation.
static java.lang.String decode(java.lang.String value)
          Returns the given string parameter as base64 decoded string or null if the given string parameter is null.
static char[] encode(byte[] bytes)
          Encodes a byte array to a standard Base64 complient character array.
static java.lang.String encode(java.lang.String value)
          Returns the given string parameter as base64 encoded string or null if the given string parameter is null.
 
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(java.lang.String value)
Returns the given string parameter as base64 encoded string or null if the given string parameter is null.

Parameters:
value - The string that should be encoded.
Returns:
The base64 encoded string.

decode

public static java.lang.String decode(java.lang.String value)
Returns the given string parameter as base64 decoded string or null if the given string parameter is null.

Parameters:
value - A base64 encoded string that should be decoded. The base64 encoded string had to be encoded with the encode method of this class.
Returns:
The base64 decoded string.
Throws:
java.lang.IllegalArgumentException - or ArrayOutOfBoundsException if the given string parameter contains invalid characters. Invalid characters are those that are not part of the base64 alphabet.

encode

public static char[] encode(byte[] bytes)
Encodes a byte array to a standard Base64 complient character array.

Parameters:
bytes - The bytes that will be encoded.
Returns:
The encoded character array.

decode

public static byte[] decode(char[] chars)
Decodes a character array which is standard Base64 complient into the corresponding byte array representation.

Parameters:
chars - The character array that will be decoded.
Returns:
The decoded byte array.


Copyright © 2005 SAP AG. All Rights Reserved.