Here you can find the source of writeString(String filePath, boolean append, String content, String encoding)
public static void writeString(String filePath, boolean append, String content, String encoding) throws IOException
//package com.java2s; //License from project: Apache License import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeString(String filePath, boolean append, String content) throws IOException { writeString(filePath, append, content, "UTF-8"); }//from ww w . j ava2s . c om public static void writeString(String filePath, boolean append, String content, String encoding) throws IOException { writeBytes(filePath, append, content.getBytes(encoding)); } public static void writeBytes(String filePath, boolean append, byte[] content) throws IOException { FileOutputStream fos = new FileOutputStream(filePath, append); try { fos.write(content); fos.flush(); } finally { fos.close(); } } }