List of utility methods to do String Encode
String | encodeParameters(Map Encodes to given parameters to: StringBuffer sb = new StringBuffer(); for (Iterator<Map.Entry<String, String>> it = parameters.entrySet().iterator(); it.hasNext();) { if (sb.length() > 0) { sb.append("&"); Map.Entry<String, String> e = (Map.Entry<String, String>) it.next(); sb.append(encodeParameter(e.getKey(), e.getValue())); return sb.toString(); |
String | encodeParameters(Map encode Parameters StringBuilder encodedParams = new StringBuilder(); try { for (Map.Entry<String, String> entry : params.entrySet()) { encodedParams.append(URLEncoder.encode(entry.getKey(), paramsEncoding)); encodedParams.append('='); encodedParams.append(URLEncoder.encode(entry.getValue(), paramsEncoding)); encodedParams.append('&'); return encodedParams.delete(encodedParams.length() - 1, encodedParams.length()).toString(); } catch (UnsupportedEncodingException uee) { throw new RuntimeException("Encoding not supported: " + paramsEncoding, uee); |
String | encodeParams(final Map Computes a String representing the concatenation of all the parameters. final String utf8_encoding = "UTF-8"; StringBuilder encodedURL = new StringBuilder(); boolean isFirst = true; encodedURL.append("?"); Iterator<Entry<String, String>> iter = params.entrySet().iterator(); while (iter.hasNext()) { if (!isFirst) { encodedURL.append("&"); ... |
String | encodeParams(Map nameValuePairs) encode Params StringBuffer params = new StringBuffer(); Iterator nvp = nameValuePairs.keySet().iterator(); String name, value; char ch; while (nvp.hasNext()) { name = (String) nvp.next(); value = (String) nameValuePairs.get(name); if (value == null) ... |
List | encodeParams(String encoding, String... params) Encodes the list of path parts that will be separated by /. List<String> encodedParams = Arrays.asList(params); for (int i = 0; i < encodedParams.size(); ++i) { encodedParams.set(i, URLEncoder.encode(params[i], encoding)); return encodedParams; |
String | EncodePath(String path) Encode Path if (path.startsWith("/")) { path = path.substring(1); String[] pathElements = path.split("/"); StringBuffer sb = new StringBuffer(); for (String string : pathElements) { sb.append("/").append(URLEncoder.encode(string, "UTF-8")); return sb.toString(); |
String | encodePath(String path) URL encode a path string using UTF-8. int i = path.indexOf('/'); StringBuilder sb = new StringBuilder(); while (i != -1) { sb.append(encode(path.substring(0, i))).append('/'); path = path.substring(i + 1); i = path.indexOf('/'); sb.append(encode(path)); ... |
String | encodePath(String str) encode Path return Arrays.stream(str.split("/")).map(s -> encode(s)).collect(Collectors.joining("/")); |
String | encodeRfc5849(final String value) Percent encodeRfc5849 the value as specified by the RFC5849 (3.6). try { return URLEncoder.encode(value, UTF8) .replace("+", "%20").replace("*", "%2A").replace("%7E", "~"); } catch (UnsupportedEncodingException ex) { throw new AssertionError(ex); |
String | encodeSpecialMdxCharactersInNames(String name) We need to make sure that names of multidimensional elements do not carry any MDX special characters. try { name = URLEncoder.encode(name, "UTF-8"); name = name.replace("%", "XXX"); name = name.replace(".", "YYY"); name = name.replace("-", "ZZZ"); return name; } catch (UnsupportedEncodingException e) { e.printStackTrace(); ... |