List of utility methods to do UTF8 From
byte[] | getUtf8Bytes(String str) Returns the passed string as a byte array containing the string in UTF-8 representation. try { return str.getBytes("UTF-8"); } catch (UnsupportedEncodingException uee) { return str.getBytes(); |
byte[] | getUtf8Bytes(String str) get Utf Bytes if (hasLength(str)) { try { return str.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { ; return null; ... |
InputStream | getUTF8Stream(String s) get UTF Stream try { ByteArrayOutputStream bas = new ByteArrayOutputStream(); Writer w = new OutputStreamWriter(bas, "utf-8"); w.write(s); w.close(); byte[] ba = bas.toByteArray(); ByteArrayInputStream bis = new ByteArrayInputStream(ba); return bis; ... |
String | getUTF8String(byte[] bytes) Converts string into an UTF8 String and handles the unlikely case where UTF-8 is not supported. try { return new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException exc) { return new String(bytes); |
String | getUTF8String(byte[] bytes) Utility wrapper for getting a String object out of byte [] using the UTF-8 encoding. return getEncodedString(bytes, "UTF-8"); |
String | getUTF8String(String input) get UTF String try { return new String(input.getBytes(), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return input; |