com.pushtotest.tool.util
Class URLCodec

java.lang.Object
  extended by com.pushtotest.tool.util.URLCodec
All Implemented Interfaces:
Codec

public class URLCodec
extends java.lang.Object
implements Codec

This class provides a URL Encoding functionality. It is useful for encoding parameters before they are passed into URLs and the like.


Method Summary
 char[] decode(char[] chars)
          This method is URL decodes the string passed in.
 java.lang.String decode(java.lang.String chars)
          This method is URL decodes the string passed in.
 char[] encode(char[] chars)
          This method is URL encodes the character array passed in.
 java.lang.String encode(java.lang.String chars)
          This method is URL encodes the string passed in.
static URLCodec getInstance()
          Returns an instance of the specific codec to be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static URLCodec getInstance()
Returns an instance of the specific codec to be used. This is so they can be singletons and reused.

Returns:
The Codec object to use.

encode

public final java.lang.String encode(java.lang.String chars)
This method is URL encodes the string passed in. It is a wrapper around the JDK URLEncoder object.

Specified by:
encode in interface Codec
Parameters:
chars - The plain text string that should be encode
Returns:
The encoded version of the string passed in.

encode

public final char[] encode(char[] chars)
This method is URL encodes the character array passed in. It is a wrapper around the JDK URLEncoder object.

Specified by:
encode in interface Codec
Parameters:
chars - The plain text string that should be encode
Returns:
The encoded version of the string passed in.

decode

public final char[] decode(char[] chars)
This method is URL decodes the string passed in. It is a wrapper around the JDK URLDecoder object.

Specified by:
decode in interface Codec
Parameters:
chars - The plain text string that should be encode
Returns:
The encoded version of the string passed in.

decode

public final java.lang.String decode(java.lang.String chars)
This method is URL decodes the string passed in. It is a wrapper around the JDK URLDecoder object.

Specified by:
decode in interface Codec
Parameters:
chars - The plain text string that should be encode
Returns:
The encoded version of the string passed in.