List of utility methods to do String Encode
String | encodeFilenameOmittingWhiteSpaces(String filename, String encoding) encode Filename Omitting White Spaces if (filename == null || filename.length() == 0) return ""; else { int index = filename.indexOf(' '); if (index == -1) { return encodeFilename(filename, encoding); } else { return URLEncoder.encode(filename.substring(0, index), encoding) + " " ... |
String | encodeForm(Map encode Form try { StringBuilder result = new StringBuilder(); for (Entry<String, Object> argument : form.entrySet()) { result.append(URLEncoder.encode(argument.getKey(), "UTF-8")); result.append('='); result.append(URLEncoder.encode(String.valueOf(argument.getValue()), "UTF-8")); result.append('&'); result.deleteCharAt(result.length() - 1); return result.toString(); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); |
String | encodeIncludingSpecialCharacters(String toEncode) Some calls in the Heroku API decode strings in a different way from URLEncoder. String encoded = urlencode(toEncode, "Unable to urlencode " + toEncode); for (Map.Entry<String, String> s : specialChars.entrySet()) { encoded = encoded.replace(s.getKey(), s.getValue()); return encoded; |
String | encodeInternally(String s) encode Internally try { return URLEncoder.encode(s, "UTF8"); } catch (UnsupportedEncodingException e) { throw new UncheckedIOException(e); |
String | encodeJobHistoryFileName(String logFileName) Helper function to encode the URL of the filename of the job-history log file. String replacementDelimiterEscape = null; if (logFileName.contains(DELIMITER_ESCAPE)) { replacementDelimiterEscape = nonOccursString(logFileName); logFileName = logFileName.replaceAll(DELIMITER_ESCAPE, replacementDelimiterEscape); String encodedFileName = null; try { encodedFileName = URLEncoder.encode(logFileName, "UTF-8"); ... |
void | encodeMap(Map map, String enc) encode Map if (null != map) { Set<String> keySet = map.keySet(); for (String key : keySet) { if (key.equals("sign") || key.equals("sign_type")) { continue; } else { try { map.put(key, URLEncoder.encode(map.get(key) + "", enc)); ... |
String | encodeName(final String name) encode Name try { return URLEncoder.encode(name, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new IllegalStateException( "Unsupported UTF-8 charset. Scenarioo needs to run on a JVM or server environment that supports 'UTF-8'.", e); |
String | encodeName(String createdName) encode Name try { return URLEncoder.encode(URLEncoder.encode(createdName, "UTF-8"), "UTF-8"); } catch (final UnsupportedEncodingException e) { e.printStackTrace(); return createdName; |
String | encodeParameter(String key, String value) Encodes to given key to: StringBuffer sb = new StringBuffer(); sb.append(encode(key)); sb.append("="); sb.append(encode(value)); return sb.toString(); |
String | encodeParameters(Map Returns a properly encoded string of parameters. if (parameters == null) { return ""; StringBuilder b = new StringBuilder(); boolean first = true; for (String key : parameters.keySet()) { if (!first) { b.append("&"); ... |