【发布时间】:2014-12-04 04:54:32
【问题描述】:
我需要使用 UTF-8 将字节数组中的每个字节 b 转换为字符串。我能够使用 UTF-8 将整个字节数组转换为字符串。请帮助。下面是我的代码,其中包含字节数组的缓冲区。
String str = new String(buffer, "UTF-8");
// convert the array of bytes to characters using the default encoding.
Log.d("es.pymasde.blueterm",str);
// for each byte in the buffer(byte array)
for(byte b:buffer)
{
//Here I need to convert Each Byte b to string using UTF-8
}
【问题讨论】: