List of utility methods to do URL Encode
String | encode(String s) Equivalent to #encode(String,String) with second parameter set to the "UTF-8" encoding. return encode(s, UTF8);
|
String | encode(String s) URL Encodes the given String s using the UTF-8 character encoding.
if (s == null) return null; try { return URLEncoder.encode(s, "UTF-8"); } catch (UnsupportedEncodingException e) { return null; |
String | encode(String s) Like URLEncoder.encode, except translates spaces into %20 instead of + if (s == null) { return ""; try { return URLEncoder.encode(s, "UTF-8").replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { return URLEncoder.encode(s).replaceAll("\\+", "%20"); |
String | encode(String s) URL encoding. try { if (s != null) return URLEncoder.encode(s, "UTF-8"); else return s; } catch (UnsupportedEncodingException e) { return s; |
String | encode(String s, String enc) Pass through to the java.net.URLEncoder . if (urlEncode != null) { try { return (String) urlEncode.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) { ... |
String | encode(String s, String encoding) Calls java.net.URLEncoder.encode(String, String) via reflection, if we are running on JRE 1.4 or later, otherwise reverts to the deprecated URLEncoder.encode(String) method.
Class c = URLEncoder.class; String result = null; try { Method m = c.getDeclaredMethod("encode", STRING_ARGS_2); try { result = (String) m.invoke(null, new Object[] { s, encoding }); } catch (InvocationTargetException e) { e.printStackTrace(); ... |
String | encode(String source) encode StringBuffer sb = new StringBuffer(); encode(source, sb); return sb.toString(); |
String | encode(String src, String srcCode, String destCode) encode try { byte[] strby = src.getBytes(srcCode); String dest = new String(strby, destCode); return dest; } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; ... |
String | encode(String str) encodes the given string using URLEncoder. try { return java.net.URLEncoder.encode(str, "UTF-8"); } catch (java.io.UnsupportedEncodingException ue) { return str; |
String | encode(String str) Encode the specified string. try { return URLEncoder.encode(str, encode); } catch (UnsupportedEncodingException e) { return str; |