getchars()以1byte顺序排列

时间:2013-08-21 23:13:49

标签: android eclipse-adt

我设置了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

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

0 个答案:

没有答案