code: private static int channelWrite(WritableByteChannel channel,
                                    ByteBuffer buffer) throws IOException {
  
      return (buffer.remaining() <= NIO_BUFFER_LIMIT) ?
             channel.write(buffer) : channelIO(null, channel, buffer);
    }
docs: This is a wrapper around {@link WritableByteChannel#write(ByteBuffer)}.
  If the amount of data is large, it writes to channel in smaller chunks.
  This is to avoid jdk from creating many direct buffers as the size of
  buffer increases. This also minimizes extra copies in NIO layer
  as a result of multiple write operations required to write a large
  buffer.
  
  @see WritableByteChannel#write(ByteBuffer)