Errai 3.0.1-SNAPSHOT

org.jboss.errai.common.client.util
Class Base64Util

java.lang.Object
  extended by org.jboss.errai.common.client.util.Base64Util

public class Base64Util
extends Object

Base64 String to-and-from byte array utility.

This code is a modified version of Base64Encoder from the gwt-crypto project, used under the terms of the ASL 2.0 license.

Author:
gwt-crypto project (original encode/decode logic), Jonathan Fuerth (modified for Errai by removing usage of java.io)

Field Summary
protected static byte[] decodingTable
           
protected static byte padding
           
 
Constructor Summary
Base64Util()
           
 
Method Summary
static byte[] decode(String data)
          Decodes the Base64-encoded String to the equivalent binary data array.
static Byte[] decodeAsBoxed(String data)
           
static String encode(byte[] data, int off, int length)
          Encodes the input data, producing a base 64 string.
static String encode(Byte[] data, int off, int length)
          Same as encode(byte[], int, int) but accepts an array of boxed Byte values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

padding

protected static final byte padding
See Also:
Constant Field Values

decodingTable

protected static final byte[] decodingTable
Constructor Detail

Base64Util

public Base64Util()
Method Detail

encode

public static String encode(Byte[] data,
                            int off,
                            int length)
Same as encode(byte[], int, int) but accepts an array of boxed Byte values.

Parameters:
data - The sequence of bytes to encode. Every element must be non-null.
off - The offset into the data array to start encoding from
length - The number of bytes to encode, starting from off
Returns:
The base64 encoded data.

encode

public static String encode(byte[] data,
                            int off,
                            int length)
Encodes the input data, producing a base 64 string.

Parameters:
data - the data to encode. It is assumed that none of the elements are null.
off - The offset into the data array to start encoding from
length - The number of bytes to encode, starting from off
Returns:
the base64 representation of the given binary data.

decodeAsBoxed

public static Byte[] decodeAsBoxed(String data)

decode

public static byte[] decode(String data)
Decodes the Base64-encoded String to the equivalent binary data array. Whitespace characters in the input stream are ignored.

Returns:
the binary data decoded from the input string

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.