code: public void flushTo(WritableByteChannel out) throws IOException {
  		int n1 = _flushPosition / _bufferSize;
  		int n2 = _position / _bufferSize;
  		while (n1 < n2) {
  			ByteBuffer bb = _buffers.get(n1);
  			bb.rewind();
  			out.write(bb);
  			deallocateBuffer(n1);
  			_flushPosition += _bufferSize;
  			++n1;
  		}
  	}
docs: Tries to copy as much bytes as possible from this buffer to
  the given channel. This method always copies whole internal
  buffers and deallocates them afterwards. It does not deallocate
  the buffer the write position is currently pointing to nor does
  it deallocate buffers following the write position. The method
  increases an internal pointer so consecutive calls also copy
  consecutive bytes.
  @param out the channel to write to
  @throws IOException if the buffer could not be flushed