it.could.util.encoding
Class EncodingTools

java.lang.Object
  extended byit.could.util.encoding.EncodingTools
All Implemented Interfaces:
EncodingAware

public final class EncodingTools
extends Object
implements EncodingAware

An utility class providing various static methods dealing with encodings and Encodable objects..

Author:
Pier Fumagalli

Field Summary
 
Fields inherited from interface it.could.util.encoding.EncodingAware
DEFAULT_ENCODING, PLATFORM_ENCODING
 
Method Summary
static String base64Decode(String string)
          Decode the specified base 64 string using the default encoding.
static String base64Decode(String string, String encoding)
          Decode the specified base 64 string using the specified encoding.
static String base64Encode(String string)
          Encode the specified string in base 64 using the default encoding.
static String base64Encode(String string, String encoding)
          Encode the specified string in base 64 using the specified encoding.
static String toString(Encodable encodable)
          Return the String representation of the specified Encodable object using the default encoding.
static String urlDecode(String source)
          URL-decode the specified string.
static String urlDecode(String source, String encoding)
          URL-decode the specified string.
static String urlEncode(String source)
          URL-encode the specified string.
static String urlEncode(String source, String encoding)
          URL-encode the specified string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toString

public static String toString(Encodable encodable)

Return the String representation of the specified Encodable object using the default encoding.

throws NullPointerException if the Encodable was null.


urlEncode

public static String urlEncode(String source,
                               String encoding)
                        throws UnsupportedEncodingException

URL-encode the specified string.

Throws:
UnsupportedEncodingException

urlEncode

public static String urlEncode(String source)

URL-encode the specified string.


urlDecode

public static String urlDecode(String source,
                               String encoding)
                        throws UnsupportedEncodingException

URL-decode the specified string.

Throws:
UnsupportedEncodingException

urlDecode

public static String urlDecode(String source)

URL-decode the specified string.


base64Encode

public static final String base64Encode(String string,
                                        String encoding)
                                 throws UnsupportedEncodingException

Encode the specified string in base 64 using the specified encoding.

Throws:
UnsupportedEncodingException

base64Encode

public static final String base64Encode(String string)

Encode the specified string in base 64 using the default encoding.


base64Decode

public static final String base64Decode(String string,
                                        String encoding)
                                 throws UnsupportedEncodingException

Decode the specified base 64 string using the specified encoding.

Throws:
UnsupportedEncodingException

base64Decode

public static final String base64Decode(String string)

Decode the specified base 64 string using the default encoding.