com.arunta.base.util
Class DBCodec

java.lang.Object
  extended by com.arunta.base.util.DBCodec

public class DBCodec
extends java.lang.Object

String encoder and decoder.


Constructor Summary
DBCodec()
           
 
Method Summary
static java.lang.String bareBonesDecode(java.lang.String s)
          Decodes a x-www-form-urlencoded string that does not include the encoded tag.
static java.lang.String bareBonesEncode(java.lang.String s)
          Translates a string into encoded format, but doesn't include the encoded tag.
static java.lang.String decode(java.lang.String s)
          Decodes a x-www-form-urlencoded string that includes the encoded tag.
static java.lang.String decode(java.lang.String s, java.lang.String enc)
          Decodes a application/x-www-form-urlencoded string using a specific encoding scheme.
static java.lang.String encode(java.lang.String s)
          Translates a string into encoded format and include the encoded tag.
static java.lang.String encode(java.lang.String s, java.lang.String enc)
          Translates a string into encoded format using a specific encoding scheme.
static boolean isEncoded(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBCodec

public DBCodec()
Method Detail

isEncoded

public static boolean isEncoded(java.lang.String s)

encode

public static java.lang.String encode(java.lang.String s)
Translates a string into encoded format and include the encoded tag.

Parameters:
s - The String to be translated.
Returns:
The translated String.

decode

public static java.lang.String decode(java.lang.String s)
Decodes a x-www-form-urlencoded string that includes the encoded tag.

The platform's default encoding is used to determine what characters are represented by any consecutive sequences of the form " %xy".

Parameters:
s - The String to decode
Returns:
The newly decoded String

bareBonesEncode

public static java.lang.String bareBonesEncode(java.lang.String s)
Translates a string into encoded format, but doesn't include the encoded tag.

Parameters:
s - The String to be translated.
Returns:
The translated String.

bareBonesDecode

public static java.lang.String bareBonesDecode(java.lang.String s)
Decodes a x-www-form-urlencoded string that does not include the encoded tag.

The platform's default encoding is used to determine what characters are represented by any consecutive sequences of the form " %xy".

Parameters:
s - The String to decode
Returns:
The newly decoded String

encode

public static java.lang.String encode(java.lang.String s,
                                      java.lang.String enc)
                               throws java.io.UnsupportedEncodingException
Translates a string into encoded format using a specific encoding scheme.

The supplied encoding is used to determine what characters are represented by any consecutive sequences of the form " %xy".

Note: The World Wide Web Consortium Recommendation states that UTF-8 should be used. Not doing so may introduce incompatibilites.

Parameters:
s - The String to encode
enc - The name of a supported character encoding.
Returns:
The newly encoded String
Throws:
java.io.UnsupportedEncodingException - If the named encoding is not supported

decode

public static java.lang.String decode(java.lang.String s,
                                      java.lang.String enc)
                               throws java.io.UnsupportedEncodingException
Decodes a application/x-www-form-urlencoded string using a specific encoding scheme.

The supplied encoding is used to determine what characters are represented by any consecutive sequences of the form " %xy".

Note: The World Wide Web Consortium Recommendation states that UTF-8 should be used. Not doing so may introduce incompatibilites.

Parameters:
s - The String to decode
enc - The name of a supported character encoding.
Returns:
The newly decoded String
Throws:
java.io.UnsupportedEncodingException - If the named encoding is not supported


Copyright ©, 2005-2012 Prolancer Pty Ltd, Sydney Australia.