Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.net
Class URLDecoder  view URLDecoder download URLDecoder.java

java.lang.Object
  extended byjava.net.URLDecoder

public class URLDecoder
extends java.lang.Object

This utility class contains static methods that converts a string encoded in the x-www-form-urlencoded format to the original text. The x-www-form-urlencoded format replaces certain disallowed characters with encoded equivalents. All upper case and lower case letters in the US alphabet remain as is, the space character (' ') is replaced with '+' sign, and all other characters are converted to a "%XX" format where XX is the hexadecimal representation of that character in a given character encoding (default is "UTF-8").

This method is very useful for decoding strings sent to CGI scripts Written using on-line Java Platform 1.2/1.4 API Specification. Status: Believed complete and correct.

Since:
1.2

Constructor Summary
URLDecoder()
          Public contructor.
 
Method Summary
static java.lang.String decode(java.lang.String s)
          Deprecated.  
static java.lang.String decode(java.lang.String s, java.lang.String encoding)
          This method translates the passed in string from x-www-form-urlencoded format using the given character encoding to decode the hex encoded unsafe characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLDecoder

public URLDecoder()
Public contructor. Note that this class has only static methods.

Method Detail

decode

public static java.lang.String decode(java.lang.String s)
Deprecated.  

This method translates the passed in string from x-www-form-urlencoded format using the default encoding "UTF-8" to decode the hex encoded unsafe characters.


decode

public static java.lang.String decode(java.lang.String s,
                                      java.lang.String encoding)
                               throws java.io.UnsupportedEncodingException
This method translates the passed in string from x-www-form-urlencoded format using the given character encoding to decode the hex encoded unsafe characters. This implementation will decode the string even if it contains unsafe characters (characters that should have been encoded) or if the two characters following a % do not represent a hex encoded byte. In those cases the unsafe character or the % character will be added verbatim to the decoded result.

Since:
1.4