private void flushBuffer(ByteBuffer buffer,WritableByteChannel output) throws IOException {
  buffer.flip();
  output.write(buffer);
  buffer.flip();
  buffer.limit(buffer.capacity());
}

private void flushBuffer ( ByteBuffer buffer , WritableByteChannel output ) throws IOException { buffer . flip ( ) ; output . write ( buffer ) ; buffer . flip ( ) ; buffer . limit ( buffer . capacity ( ) ) ; }
flush the current write buffer to disk .
