Here you can find the source of writeString(String path, String data)
public static void writeString(String path, String data) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; public class Main { public static void writeString(String path, String data) throws IOException { try (BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(path), StandardCharsets.UTF_8))) { writer.write(data);//from w w w .j a va 2 s.c o m } } }