code: private void write(IoSession session, IoBuffer data, IoBuffer buf) {
          try {
              int len = data.remaining();
              if (len >= buf.capacity()) {
                  /*
                   * If the request length exceeds the size of the output buffer,
                   * flush the output buffer and then write the data directly.
                   */
                  NextFilter nextFilter = session.getFilterChain().getNextFilter(
                          this);
                  internalFlush(nextFilter, session, buf);
                  nextFilter.filterWrite(session, new DefaultWriteRequest(data));
                  return;
              }
              if (len > (buf.limit() - buf.position())) {
                  internalFlush(session.getFilterChain().getNextFilter(this),
                          session, buf);
              }
              synchronized (buf) {
                  buf.put(data);
              }
          } catch (Throwable e) {
              session.getFilterChain().fireExceptionCaught(e);
          }
      }
docs: Writes <code>data</code> {@link IoBuffer} to the <code>buf</code>
  {@link IoBuffer} which buffers write requests for the
  <code>session</code> {@ link IoSession} until buffer is full
  or manually flushed.
  
  @param session the session where buffer will be written
  @param data the data to buffer
  @param buf the buffer where data will be temporarily written