protected void writeFile(String template,Writer writer){
  if (template == null) {
    throw new IllegalArgumentException("template content can not be null.");
  }
  BufferedWriter bufferedWriter=new BufferedWriter(writer);
  String output=replace(template,null);
  try {
    bufferedWriter.append(output);
  }
 catch (  IOException e) {
    logger.log(Diagnostic.Kind.ERROR,"write file failed");
    e.printStackTrace();
  }
 finally {
    try {
      bufferedWriter.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

protected void writeFile ( String template , Writer writer ) { if ( template == null ) { throw new IllegalArgumentException ( "template content can not be null." ) ; } BufferedWriter bufferedWriter = new BufferedWriter ( writer ) ; String output = replace ( template , null ) ; try { bufferedWriter . append ( output ) ; } catch ( IOException e ) { logger . log ( Diagnostic . Kind . ERROR , "write file failed" ) ; e . printStackTrace ( ) ; } finally { try { bufferedWriter . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } }
replace placeholder in template
