private byte[] readArray(Command command,int value,int index,int length) throws LibUsbException, UsbException {
  if (mDeviceHandle != null) {
    ByteBuffer buffer=ByteBuffer.allocateDirect(length);
    int transferred=LibUsb.controlTransfer(mDeviceHandle,USB_REQUEST_IN,command.getValue(),(short)value,(short)index,buffer,USB_TIMEOUT_MS);
    if (transferred < 0) {
      throw new LibUsbException("read error",transferred);
    }
    byte[] results=new byte[transferred];
    buffer.get(results);
    return results;
  }
 else {
    throw new LibUsbException("device handle is null",LibUsb.ERROR_NO_DEVICE);
  }
}

private byte [ ] readArray ( Command command , int value , int index , int length ) throws LibUsbException , UsbException { if ( mDeviceHandle != null ) { ByteBuffer buffer = ByteBuffer . allocateDirect ( length ) ; int transferred = LibUsb . controlTransfer ( mDeviceHandle , USB_REQUEST_IN , command . getValue ( ) , ( short ) value , ( short ) index , buffer , USB_TIMEOUT_MS ) ; if ( transferred < 0 ) { throw new LibUsbException ( "read error" , transferred ) ; } byte [ ] results = new byte [ transferred ] ; buffer . get ( results ) ; return results ; } else { throw new LibUsbException ( "device handle is null" , LibUsb . ERROR_NO_DEVICE ) ; } }
reads a multi - byte value from the device
