Java Utililty Methods URI Decode

List of utility methods to do URI Decode

Description

The list of methods to do URI Decode are organized into topic(s).

Method

StringdecodeURI(URI uri)
Decode a URI by converting all percent encoded character into a String character.
StringBuffer retVal = new StringBuffer();
String uriStr = uri.toASCIIString();
char c;
for (int i = 0; i < uriStr.length(); ++i) {
    c = uriStr.charAt(i);
    if (c == '%') {
        if (((uriStr.length() - i) < 2)) {
            throw new IllegalArgumentException(
...
StringdecodeURIComponent(String s, String charset)
Decodes the passed String using an algorithm that's compatible with JavaScript's decodeURIComponent function.
if (s == null) {
    return null;
String result = null;
try {
    result = URLDecoder.decode(s, charset);
catch (UnsupportedEncodingException e) {
...
MapdecodeURItoMap(String URIstring)
decode UR Ito Map
HashMap<String, Object> map = new HashMap<String, Object>();
try {
    URIstring = java.net.URLDecoder.decode(URIstring, "UTF-8");
    ObjectMapper mapper = new ObjectMapper();
    map = mapper.readValue(URIstring, new TypeReference<Map<String, Object>>() {
    });
} catch (Exception e) {
return map;
StringuriDecode(String encoded)
uri Decode
return URLDecoder.decode(encoded, "UTF-8");
StringuriDecodePath(String path)
uri Decode Path
if (path == null) {
    return null;
try {
    return new URI(path).getPath();
} catch (URISyntaxException e) {
    throw new IllegalArgumentException(String.format("uriDecode failed, path=\"%s\".", path), e);
StringuriDecoding(String str)
uri Decoding
String result = str;
try {
    result = URLDecoder.decode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
return result;