0

我设置了一个getchars()调用测试示例,返回的字节顺序为 1。

byte [] readBufA = new byte [] {1,2,3,4,5,6,7}; // Test array

然后我运行 getchar,结果为 1。

String strIncom = new String(readBufA, 0, 7); // create string from bytes array
String strIncom = new String(readBuf, 0, msg.arg1); // create string from bytes array

sb.append(strIncom); // append string
int counter = sb.length(); // Get length of string
if (counter == 7){

getChars(0,7,readBufA,0);


Log.d(TAG, "Data " + sb + "  Size  " + (char)readBuf[0] + " " + (char)readBuf[1] +
" " + (char)readBuf[2] + " " + (char)readBuf[3] + " " +(char)readBuf[4] + 
" " + (char)readBuf[5] + " " + (char)readBuf[6] +" " + (char)readBuf[7]+ " " + counter); // receive massage

返回 (2,3,4,5,6,7,-,-,7) 计数器是正确的log.d,但看不到正确的返回

4

0 回答 0