Here you can find the source of writeToFile(Path file, String content)
public static void writeToFile(Path file, String content) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; public class Main { private static final String CHARSET = "UTF-8"; /**/*w w w .j av a 2 s . co m*/ * Writes given string to a file. * Will create the file if it does not exist yet. */ public static void writeToFile(Path file, String content) throws IOException { Files.write(file, content.getBytes(CHARSET)); } }