Java Utililty Methods UTF8 From

List of utility methods to do UTF8 From

Description

The list of methods to do UTF8 From are organized into topic(s).

Method

StringgetUTF8(byte[] bytes)
get UTF
return new String(bytes, "UTF-8");
byte[]getUTF8(String data)
get UTF
try {
    return data.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
    return null;
StringgetUTF8(String s)
get UTF
if (s == null || s.equals("")) {
    return "";
String ss = "";
try {
    ss = new String(s.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
...
byte[]getUTF8(String string)
Encodes a string as an array of UTF-8 bytes.
try {
    return string.getBytes("UTF-8");
} catch (UnsupportedEncodingException ex) {
    throw new AssertionError(ex);
byte[]getUTF8Bytes(String data)
get UTF Bytes
return data.getBytes("UTF-8");
byte[]getUtf8Bytes(String s)
get Utf Bytes
return safeGetBytes(s, UTF_8);
byte[]getUTF8Bytes(String s)
get UTF Bytes
return s.getBytes("UTF-8");
byte[]getUTF8Bytes(String s)
Convert a String into a byte[] encoded by UTF-8.
return getBytes(s, "UTF-8");
byte[]getUtf8Bytes(String s)
get Utf Bytes
try {
    return s.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
    throw new RuntimeException("UTF-8 not found.", e);
byte[]getUTF8Bytes(String str)
get UTF Bytes
byte[] bytes = null;
try {
    bytes = str.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
    logger.log(Level.WARNING, "UTF-8 decoding error, continue by using default instead", e);
    bytes = str.getBytes();
return bytes;
...