private String utfToString(byte[] data) {
str = new String(data, "utf-8");
} catch (UnsupportedEncodingException e) {
}
String str = null;
try {str = new String(data, "utf-8");
} catch (UnsupportedEncodingException e) {
}
return str;
}
本文介绍了一个简单的Java方法,用于将UTF-8编码的字节数组转换为字符串。此方法捕获并忽略UnsupportedEncodingException异常。

2万+

被折叠的 条评论
为什么被折叠?



