Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android ByteBuffer获取备份阵列_Java_Android_Arrays_Usb_Byte - Fatal编程技术网

Java Android ByteBuffer获取备份阵列

Java Android ByteBuffer获取备份阵列,java,android,arrays,usb,byte,Java,Android,Arrays,Usb,Byte,我怎样才能从ByteBuffer那里回到Array。 这是我的密码 while (true) { for (String cmd : commands) { buffer.clear(); buffer.put(hexStringToByteArray(cmd)); request.queue(buffer, 1); if (connection.requestWait() == request) {

我怎样才能从ByteBuffer那里回到Array。 这是我的密码

while (true) {
    for (String cmd : commands) {
        buffer.clear();
        buffer.put(hexStringToByteArray(cmd));
        request.queue(buffer, 1);
        if (connection.requestWait() == request) {
            if (inRequest.queue(buffer, bufferMaxLength) == true) {
                connection.requestWait();
                bytes = new byte[buffer.remaining()];
                buffer.get(bytes,0, bytes.length);

首先解释这段代码的作用。然后告诉我什么是备份阵列。我正在尝试与USB设备通信。我期望来自usb设备的响应出现在ByteBuffer的备份阵列中。我可以在调试器窗口中看到具有预期响应的backingArray,但我可以将其作为字节数组获取;然而,1。这不适用于直接分配的缓冲区和2。您将真正获得原始阵列并丢失所有位置/限制信息。也许你想用。翻转。