private void flushWriteChunk(){
  if (writeChunk == null)   return;
  if (writeChunk.position() == 0)   return;
  if (!writeChunk.hasRemaining()) {
    bytesWritten+=writeChunk.position();
    writeChunk.flip();
    list.addLast(writeChunk);
    writeChunk=null;
    return;
  }
  bytesWritten+=writeChunk.position();
  ByteBuffer flushChunk=writeChunk;
  writeChunk=writeChunk.slice();
  writeChunk.order(order);
  flushChunk.flip();
  list.addLast(flushChunk);
  return;
}

private void flushWriteChunk ( ) { if ( writeChunk == null ) return ; if ( writeChunk . position ( ) == 0 ) return ; if ( ! writeChunk . hasRemaining ( ) ) { bytesWritten += writeChunk . position ( ) ; writeChunk . flip ( ) ; list . addLast ( writeChunk ) ; writeChunk = null ; return ; } bytesWritten += writeChunk . position ( ) ; ByteBuffer flushChunk = writeChunk ; writeChunk = writeChunk . slice ( ) ; writeChunk . order ( order ) ; flushChunk . flip ( ) ; list . addLast ( flushChunk ) ; return ; }
flushes write chunk to internal buffer . empties writechunk ( of bytes to write ) .
