public static void writeStringToFile(Path file,String text) throws IOException {
  byte[] buf=text.getBytes(StandardCharsets.UTF_8);
  Files.write(file,buf);
}

public static void writeStringToFile ( Path file , String text ) throws IOException { byte [ ] buf = text . getBytes ( StandardCharsets . UTF_8 ) ; Files . write ( file , buf ) ; }
java nio replacement of commons - io
