docs: public void writeDirect ( byte[] b, int off, int len, int flags ) throws IOException {
          if ( len <= 0 ) {
              return;
          }
  
          if ( this.tmp == null ) {
              throw new IOException("Bad file descriptor");
          }
  
          try ( SmbFileHandleImpl fh = ensureOpen();
                SmbTreeHandleImpl th = fh.getTree() ) {
              if ( log.isDebugEnabled() ) {
                  log.debug("write: fid=" + fh + ",off=" + off + ",len=" + len);
              }
  
              int w;
              do {
                  int blockSize = ( this.file.getType() == SmbConstants.TYPE_FILESYSTEM ) ? this.writeSizeFile : this.writeSize;
                  w = len > blockSize ? blockSize : len;
  
                  if ( this.smb2 ) {
                      Smb2WriteRequest wr = new Smb2WriteRequest(th.getConfig(), fh.getFileId());
                      wr.setOffset(this.fp);
                      wr.setData(b, off, w);
  
                      Smb2WriteResponse resp = th.send(wr, RequestParam.NO_RETRY);
                      long cnt = resp.getCount();
                      this.fp += cnt;
                      len -= cnt;
                      off += cnt;
                  }
                  else if ( this.useNTSmbs ) {
                      this.reqx.setParam(fh.getFid(), this.fp, len - w, b, off, w);
                      if ( ( flags & 1 ) != 0 ) {
                          this.reqx.setParam(fh.getFid(), this.fp, len, b, off, w);
                          this.reqx.setWriteMode(0x8);
                      }
                      else {
                          this.reqx.setWriteMode(0);
                      }
  
                      th.send(this.reqx, this.rspx, RequestParam.NO_RETRY);
                      long cnt = this.rspx.getCount();
                      this.fp += cnt;
                      len -= cnt;
                      off += cnt;
                  }
                  else {
                      if ( log.isTraceEnabled() ) {
                          log.trace(String.format("Wrote at %d remain %d off %d len %d", this.fp, len - w, off, w));
                      }
                      this.req.setParam(fh.getFid(), this.fp, len - w, b, off, w);
                      th.send(this.req, this.rsp);
                      long cnt = this.rsp.getCount();
                      this.fp += cnt;
                      len -= cnt;
                      off += cnt;
                      if ( log.isTraceEnabled() ) {
                          log.trace(String.format("Wrote at %d remain %d off %d len %d", this.fp, len - w, off, w));
                      }
                  }
  
              }
              while ( len > 0 );
          }
      }