Here you can find the source of writeStringToFile(File file, String content, String value)
public static void writeStringToFile(File file, String content, String value) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.Collections; public class Main { public static void writeStringToFile(File file, String content, String value) throws IOException { Files.write(file.toPath(), Collections.singletonList(new String(content.getBytes(value), value)), Charset.forName(value), StandardOpenOption.CREATE); }/* w w w . j a v a 2 s . c om*/ }