Java Utililty Methods URL Decode

List of utility methods to do URL Decode

Description

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

Method

Stringdecode(String s, String enc)
Pass through to the java.net.URLDecoder .
if (urlDecode != null) {
    try {
        return (String) urlDecode.invoke(s, new Object[] { s, enc });
    } catch (IllegalAccessException e) {
    } catch (InvocationTargetException e) {
        if (e.getTargetException() instanceof UnsupportedEncodingException) {
            throw (UnsupportedEncodingException) e.getTargetException();
        } else if (e.getTargetException() instanceof RuntimeException) {
...
Stringdecode(String source)
decode
if (source == null) {
    return source;
StringBuffer dst = new StringBuffer();
for (StringTokenizer tokens = new StringTokenizer(source, "+/:", true); tokens.hasMoreTokens();) {
    String token = tokens.nextToken();
    if ("+".equals(token)) {
        dst.append("+");
...
Stringdecode(String source, String encoding)
Decodes the given encoded source String into an URI.
int length = source.length();
ByteArrayOutputStream bos = new ByteArrayOutputStream(length);
for (int i = 0; i < length; i++) {
    int ch = source.charAt(i);
    if (ch == '%') {
        if ((i + 2) < length) {
            char hex1 = source.charAt(i + 1);
            char hex2 = source.charAt(i + 2);
...
Stringdecode(String source, String encoding)
Decodes the given encoded source String into an URI.
Preconditions.checkNotNull(source, "'source' must not be null");
if (Strings.isNullOrEmpty(encoding)) {
    throw new IllegalArgumentException("'encoding' must not be empty");
int length = source.length();
ByteArrayOutputStream bos = new ByteArrayOutputStream(length);
boolean changed = false;
for (int i = 0; i < length; i++) {
...
Propertiesdecode(String str)
decode
try {
    StringTokenizer st = new StringTokenizer(str, "&");
    Properties prop = new Properties();
    while (st.hasMoreElements()) {
        String t = st.nextToken();
        int i = t.indexOf("=");
        if (i > 0) {
            String key = t.substring(0, i);
...
Stringdecode(String str)
Decodes URL octets except %2f (i.e.
if (str != null) {
    StringBuilder sb = new StringBuilder();
    for (int idx = str.toLowerCase().indexOf("%2f"); idx >= 0; idx = str.toLowerCase().indexOf("%2f")) {
        sb.append(URLDecoder.decode(str.substring(0, idx), "UTF-8")).append(str.substring(idx, idx + 3));
        str = str.substring(idx + 3);
    sb.append(URLDecoder.decode(str, "UTF-8"));
    str = sb.toString();
...
Stringdecode(String value)
decode
if (isEmpty(value)) {
    return "";
try {
    return java.net.URLDecoder.decode(value, "utf-8");
} catch (Exception ex) {
    ex.printStackTrace();
return value;
Stringdecode(String value)
Hides the irritating declared exception.
try {
    return URLDecoder.decode(value, "utf-8");
} catch (UnsupportedEncodingException ex) {
    throw new RuntimeException(ex);
} catch (IllegalArgumentException ex) {
    return null;
Stringdecode(String value)
Decode a value using the URLDecoder and UTF-8
try {
    return URLDecoder.decode(value, QUERY_ENCODING);
} catch (UnsupportedEncodingException e) {
    throw new IllegalArgumentException(e);
Stringdecode(String value)
#decode(String,String) with "UTF-8" encoding
return decode(value, DEFAULT_ENCODING);