< prev index next >

src/java.base/share/classes/java/net/URLDecoder.java

Print this page




  64  *     that contain one or more of these byte sequences consecutively
  65  *     will be replaced by the character(s) whose encoding would result
  66  *     in those consecutive bytes.
  67  *     The encoding scheme used to decode these characters may be specified,
  68  *     or if unspecified, the default encoding of the platform will be used.
  69  * </ul>
  70  * <p>
  71  * There are two possible ways in which this decoder could deal with
  72  * illegal strings.  It could either leave illegal characters alone or
  73  * it could throw an {@link java.lang.IllegalArgumentException}.
  74  * Which approach the decoder takes is left to the
  75  * implementation.
  76  *
  77  * @author  Mark Chamness
  78  * @author  Michael McCloskey
  79  * @since   1.2
  80  */
  81 
  82 public class URLDecoder {
  83 






  84     // The platform default encoding
  85     static String dfltEncName = URLEncoder.dfltEncName;
  86 
  87     /**
  88      * Decodes a {@code x-www-form-urlencoded} string.
  89      * The platform's default encoding is used to determine what characters
  90      * are represented by any consecutive sequences of the form
  91      * "<i>{@code %xy}</i>".
  92      * @param s the {@code String} to decode
  93      * @deprecated The resulting string may vary depending on the platform's
  94      *          default encoding. Instead, use the decode(String,String) method
  95      *          to specify the encoding.
  96      * @return the newly decoded {@code String}
  97      */
  98     @Deprecated
  99     public static String decode(String s) {
 100 
 101         String str = null;
 102 
 103         try {




  64  *     that contain one or more of these byte sequences consecutively
  65  *     will be replaced by the character(s) whose encoding would result
  66  *     in those consecutive bytes.
  67  *     The encoding scheme used to decode these characters may be specified,
  68  *     or if unspecified, the default encoding of the platform will be used.
  69  * </ul>
  70  * <p>
  71  * There are two possible ways in which this decoder could deal with
  72  * illegal strings.  It could either leave illegal characters alone or
  73  * it could throw an {@link java.lang.IllegalArgumentException}.
  74  * Which approach the decoder takes is left to the
  75  * implementation.
  76  *
  77  * @author  Mark Chamness
  78  * @author  Michael McCloskey
  79  * @since   1.2
  80  */
  81 
  82 public class URLDecoder {
  83 
  84     /**
  85      * Do not call.
  86      */
  87     @Deprecated(since="16", forRemoval=true)
  88     public URLDecoder() {}
  89 
  90     // The platform default encoding
  91     static String dfltEncName = URLEncoder.dfltEncName;
  92 
  93     /**
  94      * Decodes a {@code x-www-form-urlencoded} string.
  95      * The platform's default encoding is used to determine what characters
  96      * are represented by any consecutive sequences of the form
  97      * "<i>{@code %xy}</i>".
  98      * @param s the {@code String} to decode
  99      * @deprecated The resulting string may vary depending on the platform's
 100      *          default encoding. Instead, use the decode(String,String) method
 101      *          to specify the encoding.
 102      * @return the newly decoded {@code String}
 103      */
 104     @Deprecated
 105     public static String decode(String s) {
 106 
 107         String str = null;
 108 
 109         try {


< prev index next >