org.cruxframework.crux.core.client.encoder
Class Base64

java.lang.Object
  extended by org.cruxframework.crux.core.client.encoder.Base64

public class Base64
extends Object

Cross browser Base64 encoder / decoder. This class consider a "string" where each character represents an 8-bit byte. If you pass a string containing characters that can't be represented in 8 bits, it will probably break.

Author:
Thiago da Rosa de Bustamante

Method Summary
static String decode(String input)
          Decode the given base64 input.
static String encode(String input)
          Encode the given input into a base64 output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static String encode(String input)
Encode the given input into a base64 output. Since DOMStrings are 16-bit-encoded strings, in most browsers calling this on a Unicode string will cause a Character Out Of Range exception if a character exceeds the range of a 8-bit ASCII-encoded character. There are two possible methods to solve this problem:

the first one is to escape the whole string and then encode it;

the second one is to convert the UTF-16 DOMString to an UTF-8 array of characters and then encode it.

Parameters:
input -
Returns:

decode

public static String decode(String input)
Decode the given base64 input. This method returns a "string" where each character represents an 8-bit byte.

Parameters:
input -
Returns:


Copyright © 2014. All rights reserved.