Example usage for java.net URLDecoder decode

List of usage examples for java.net URLDecoder decode

Introduction

In this page you can find the example usage for java.net URLDecoder decode.

Prototype

public static String decode(String s, Charset charset) 

Source Link

Document

Decodes an application/x-www-form-urlencoded string using a specific java.nio.charset.Charset Charset .

Usage

From source file:Main.java

public static String urlDecode(String urlCodeStr) {
    String str = null;/*from  w  w w  .j  a  v  a  2  s .co  m*/
    try {
        str = URLDecoder.decode(urlCodeStr, "utf-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return str;
}

From source file:Main.java

public static String formUrlEncode(String urlEncodeStr) {
    try {//from ww w.ja v  a 2 s . c  om
        if (urlEncodeStr == null)
            return null;
        return URLDecoder.decode(urlEncodeStr, "UTF-8");
    } catch (Exception e) {
        // TODO: handle exception
    }
    return null;
}

From source file:Main.java

public static String decode(String s) {
    if (s == null) {
        return "";
    }/*  w  ww .  j a  v  a  2s .  co m*/
    try {
        return URLDecoder.decode(s, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:Main.java

public static String htmlDecode(String s) {
    if (s == null) {
        return null;
    }//from  w  ww .j  a  va2 s  .  c  o  m
    try {
        s = URLDecoder.decode(s, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return s;
}

From source file:Main.java

public static String URLDecoder(String str, String newCharset) throws UnsupportedEncodingException {
    if (str != null) {
        return URLDecoder.decode(str, newCharset);
    }/*from ww  w  .  j  a  v a  2  s  . com*/
    return null;
}

From source file:Main.java

public static String urlDecode(String content, String charsetName) {
    try {//from  ww w  .j av  a  2  s.c  om
        return URLDecoder.decode(content, charsetName);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return "";
}

From source file:Main.java

public static String unEscapeTemplatedURIComponent(String uri) {
    try {//from www  .  j a  v a2  s. co  m
        uri = URLDecoder.decode(uri, "utf-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    uri = restoreAll(uri, ":", "?");
    uri = restoreAll(uri, ":", "/");
    return uri;
}

From source file:Main.java

/**
 * url Decode/* ww  w.j  ava  2 s.  co  m*/
 *
 * @param content
 * @return
 */
public static String getUrlDecodeString(String content) {
    String content_ = content;
    try {
        content_ = URLDecoder.decode(content, "utf-8");
    } catch (Exception e) {
        content_ = content;
    }
    return content_;
}

From source file:Main.java

public static String parseUnicodeString(String source) {
    try {//w  w w  .ja v  a 2  s .  c om
        source = URLDecoder.decode(source, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    }
    return source;
}

From source file:Main.java

public static String urldecode(String paramString1, String paramString2) {
    if (paramString1 == null)
        return "";
    try {/*from  w  w  w.jav  a  2 s. com*/
        String str = URLDecoder.decode(paramString1, paramString2);
        return str;
    } catch (UnsupportedEncodingException localUnsupportedEncodingException) {
        throw new RuntimeException(localUnsupportedEncodingException.getMessage(),
                localUnsupportedEncodingException);
    }
}