Here you can find the source of writeFile(String folder, String aFileName, String aItem)
public static void writeFile(String folder, String aFileName, String aItem) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.IOException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { private final static Charset ENCODING = StandardCharsets.UTF_8; public static void writeFile(String folder, String aFileName, String aItem) throws IOException { Path path = Paths.get(folder, aFileName); try (BufferedWriter writer = Files.newBufferedWriter(path, ENCODING)) { writer.write(aItem);//from ww w.j ava 2s .c om writer.newLine(); } } }