public void write(Command command,int value,int index,ByteBuffer buffer) throws UsbException {
  if (mDeviceHandle != null) {
    int transferred=LibUsb.controlTransfer(mDeviceHandle,USB_REQUEST_OUT,command.getValue(),(short)value,(short)index,buffer,USB_TIMEOUT_MS);
    if (transferred < 0) {
      throw new LibUsbException("error writing byte buffer",transferred);
    }
 else     if (transferred != buffer.capacity()) {
      throw new LibUsbException("transferred bytes [" + transferred + "] is not what was expected ["+ buffer.capacity()+ "]",transferred);
    }
  }
 else {
    throw new LibUsbException("device handle is null",LibUsb.ERROR_NO_DEVICE);
  }
}

public void write ( Command command , int value , int index , ByteBuffer buffer ) throws UsbException { if ( mDeviceHandle != null ) { int transferred = LibUsb . controlTransfer ( mDeviceHandle , USB_REQUEST_OUT , command . getValue ( ) , ( short ) value , ( short ) index , buffer , USB_TIMEOUT_MS ) ; if ( transferred < 0 ) { throw new LibUsbException ( "error writing byte buffer" , transferred ) ; } else if ( transferred != buffer . capacity ( ) ) { throw new LibUsbException ( "transferred bytes [" + transferred + "] is not what was expected [" + buffer . capacity ( ) + "]" , transferred ) ; } } else { throw new LibUsbException ( "device handle is null" , LibUsb . ERROR_NO_DEVICE ) ; } }
writes the buffer contents to the device
