private static int flushBuffer(Writer out,char[] buffer,int bufferIndex) throws IOException {
  if (bufferIndex > 0)   out.write(buffer,0,bufferIndex);
  return 0;
}

private static int flushBuffer ( Writer out , char [ ] buffer , int bufferIndex ) throws IOException { if ( bufferIndex > 0 ) out . write ( buffer , 0 , bufferIndex ) ; return 0 ; }
flush the contents of the buffer to the output stream and return the reset buffer index
