com.google.api.client.util
Class Base64

java.lang.Object
  extended by com.google.api.client.util.Base64

public class Base64
extends Object


Method Summary
static byte[] decode(byte[] source)
          Low-level access to decoding ASCII characters in the form of a byte array.
static byte[] decode(byte[] source, int off, int len)
          Low-level access to decoding ASCII characters in the form of a byte array.
static byte[] encode(byte[] source)
          Similar to encode(byte[]) but returns a byte array instead of instantiating a String.
static byte[] encode(byte[] source, int off, int len)
          Similar to encode(byte[], int, int) but returns a byte array instead of instantiating a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static byte[] encode(byte[] source)
Similar to encode(byte[]) but returns a byte array instead of instantiating a String. This is more efficient if you're working with I/O streams and have large data sets to encode.

Parameters:
source - The data to convert
Returns:
The Base64-encoded data as a byte[] (of ASCII characters)
Throws:
NullPointerException - if source array is null
Since:
2.3.1

encode

public static byte[] encode(byte[] source,
                            int off,
                            int len)
Similar to encode(byte[], int, int) but returns a byte array instead of instantiating a String. This is more efficient if you're working with I/O streams and have large data sets to encode.

Parameters:
source - The data to convert
off - Offset in array where conversion should begin
len - Length of data to convert
Returns:
The Base64-encoded data as a String
Throws:
NullPointerException - if source array is null
IllegalArgumentException - if source array, offset, or length are invalid
Since:
2.3.1

decode

public static byte[] decode(byte[] source)
                     throws IOException
Low-level access to decoding ASCII characters in the form of a byte array. Ignores GUNZIP option, if it's set. This is not generally a recommended method, although it is used internally as part of the decoding process. Special case: if len = 0, an empty array is returned. Still, if you need more speed and reduced memory footprint (and aren't gzipping), consider this method.

Parameters:
source - The Base64 encoded data
Returns:
decoded data
Throws:
IOException
Since:
2.3.1

decode

public static byte[] decode(byte[] source,
                            int off,
                            int len)
                     throws IOException
Low-level access to decoding ASCII characters in the form of a byte array. Ignores GUNZIP option, if it's set. This is not generally a recommended method, although it is used internally as part of the decoding process. Special case: if len = 0, an empty array is returned. Still, if you need more speed and reduced memory footprint (and aren't gzipping), consider this method.

Parameters:
source - The Base64 encoded data
off - The offset of where to begin decoding
len - The length of characters to decode
Returns:
decoded data
Throws:
IOException - If bogus characters exist in source data
Since:
1.3


Copyright © 2011 Google. All Rights Reserved.