private void replaceFile(String file,String body) throws IOException {
  try (OutputStream out=new BufferedOutputStream(new FileOutputStream(file))){
    out.write(body.getBytes());
  }
 }

private void replaceFile ( String file , String body ) throws IOException { try ( OutputStream out = new BufferedOutputStream ( new FileOutputStream ( file ) ) ) { out . write ( body . getBytes ( ) ) ; } }
replaces file with given body .
