Here you can find the source of write(Path path, String string)
public static void write(Path path, String string) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void write(Path path, String string) throws IOException { PrintWriter out = null;/*from w ww.j a v a 2 s. co m*/ try { out = new PrintWriter(Files.newOutputStream(path)); out.write(string); } finally { if (out != null) { out.close(); } } } }