Spring for Android

org.springframework.util
Class Base64Utils

java.lang.Object
  extended by org.springframework.util.Base64Utils

public class Base64Utils
extends java.lang.Object

Utility class for Base64 encoding. Froyo and newer versions of Android include Base64 support. If the environment is determined to be Froyo or later, then this class delegates to Base64. If the version is older than Froyo, then Robert Harder's public domain Base64 class is used.

Author:
Roy Clarkson
See Also:
Base64

Constructor Summary
Base64Utils()
           
 
Method Summary
static byte[] decode(byte[] input)
          Base64 decodes the input.
static byte[] decode(java.lang.String str)
          Base64 decodes the input.
static byte[] encode(byte[] input)
          Base64 encodes the input.
static java.lang.String encodeToString(byte[] input)
          Base64 encodes the input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64Utils

public Base64Utils()
Method Detail

encode

public static byte[] encode(byte[] input)
Base64 encodes the input. If the version of Android is Froyo or newer, then this method delegates to Base64.encode(byte[], int). Otherwise Base64.encodeBytesToBytes(byte[]) is used.

Parameters:
input - the byte array to encode
Returns:
encoded byte array

encodeToString

public static java.lang.String encodeToString(byte[] input)
Base64 encodes the input. If the version of Android is Froyo or newer, then this method delegates to Base64.encodeToString(byte[], int). Otherwise Base64.encodeBytes(byte[]) is used.

Parameters:
input - the byte array to encode
Returns:
encoded String

decode

public static byte[] decode(byte[] input)
Base64 decodes the input. If the version of Android is Froyo or newer, then this method delegates to Base64.decode(byte[], int). Otherwise Base64.decode(byte[]) is used.

Parameters:
input - the byte array to decode
Returns:
decoded byte array

decode

public static byte[] decode(java.lang.String str)
Base64 decodes the input. If the version of Android is Froyo or newer, then this method delegates to Base64.decode(String, int). Otherwise Base64.decode(String) is used.

Parameters:
str - the String the decode
Returns:
decoded byte array

Spring for Android