小编Ras*_*ail的帖子

0x0A和0x0D之间的差异

我正在研究蓝牙,我正在尝试编写代码以便在连接时继续收听输入流,并且我遇到了以下代码片段:

int data = mmInStream.read();
   if(data == 0x0A) { 
                } else if(data == 0x0D) {
                    buffer = new byte[arr_byte.size()];
                    for(int i = 0 ; i < arr_byte.size() ; i++) {
                        buffer[i] = arr_byte.get(i).byteValue();
                    }
                    // Send the obtained bytes to the UI Activity
                    mHandler.obtainMessage(BluetoothState.MESSAGE_READ
                            , buffer.length, -1, buffer).sendToTarget();
                    arr_byte = new ArrayList<Integer>();
                } else {
                    arr_byte.add(data);
                }
Run Code Online (Sandbox Code Playgroud)

有人可以解释0x0A和0x0D之间的区别.并且还简要说明了这段代码.请分享您的观点.

java buffer hex bluetooth character

7
推荐指数
1
解决办法
3万
查看次数

标签 统计

bluetooth ×1

buffer ×1

character ×1

hex ×1

java ×1