Java URL Decode decode(String value)

Here you can find the source of decode(String value)

Description

Decode a value using the URLDecoder and UTF-8

License

Apache License

Parameter

Parameter Description
value The value to decode

Return

The decoded value.

Declaration

public static String decode(String value) 

Method Source Code

//package com.java2s;
/**/* w ww . jav  a2s  . co  m*/
 * Copyright 2012-, Cloudsmith Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not
 * use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

import java.io.UnsupportedEncodingException;

import java.net.URLDecoder;

public class Main {
    private static final String QUERY_ENCODING = "UTF-8";

    /**
     * Decode a value using the URLDecoder and UTF-8
     * 
     * @param value The value to decode
     * @return The decoded value.
     */
    public static String decode(String value) {
        try {
            return URLDecoder.decode(value, QUERY_ENCODING);
        } catch (UnsupportedEncodingException e) {
            throw new IllegalArgumentException(e);
        }
    }
}

Related

  1. decode(String str)
  2. decode(String str)
  3. decode(String value)
  4. decode(String value)
  5. decode(String value)
  6. decode(String value, String charset)
  7. decode(String value, String charset)
  8. decode(String value, String encoding)
  9. decodeAjax(String value)