Here you can find the source of writeStringToFile(String content, Path targetPath)
public static Path writeStringToFile(String content, Path targetPath) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; public class Main { public static Path writeStringToFile(String content, Path targetPath) throws IOException { return Files.write(targetPath, content.getBytes(), StandardOpenOption.CREATE_NEW); }//from w w w .ja v a2 s . c om }