StringBuffer result = new StringBuffer(src.length());
ByteArrayOutputStream bos = new ByteArrayOutputStream(src.length());
    public static String uriDecode(String src) {        // this is string in ASCII-US encoding.        boolean query = false;        boolean decoded = false;        StringBuffer result = new StringBuffer(src.length());        for(int i = 0; i < src.length(); i++) {            char ch = src.charAt(i);            if (ch == '?') {                query = true;            } else if (ch == '+' && query) {                ch = ' ';            } else if (ch == '%' && i + 2 < src.length() &&                    isHexDigit(src.charAt(i + 1)) &&                     isHexDigit(src.charAt(i + 2))) {                int code = hexValue(src.charAt(i + 1))*0x10 + hexValue(src.charAt(i + 2));                ch = (char) code;                decoded = true;                i += 2;                }            result.append(ch);        }        if (!decoded) {            return src;        }        return result.toString();    }