List of utility methods to do String Encode by Charset
byte[] | getHeader(Charset encoding) get Header byte[] header = null; if (encoding.toString().equals("UTF-32LE")) { header = new byte[] { (byte) 0xFF, (byte) 0xFE, (byte) 0x00, (byte) 0x00 }; } else if (encoding.toString().equals("UTF-32BE")) { header = new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0xFE, (byte) 0xFF }; } else if (encoding.toString().equals("UTF-16LE")) { header = new byte[] { (byte) 0xFF, (byte) 0xFE }; } else if (encoding.toString().equals("UTF-16BE")) { ... |
String | loadAsString(String locationPattern, Charset encoding) load As String URL url = Resources.getResource(locationPattern);
return Resources.toString(url, encoding);
|
String | pathEncode(String path, Charset charset) Uri Encode a Path Fragment. return encodeReserved(path, PATH_RESERVED_CHARACTERS, charset);
|
String | urlEncode(final String content, final Charset charset, final BitSet safechars, final boolean blankAsPlus) url Encode if (content == null) { return null; final StringBuilder buf = new StringBuilder(); final ByteBuffer bb = charset.encode(content); while (bb.hasRemaining()) { final int b = bb.get() & 0xff; if (safechars.get(b)) { ... |
String | urlEncode(final String str, final Charset encoding) url Encode try { return URLEncoder.encode(str, encoding.name()); } catch (final UnsupportedEncodingException x) { throw new RuntimeException(x); |
String | urlEncode(String url, Charset cs) url Encode try { return URLEncoder.encode(url, cs.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); |