Here you can find the source of writeStringToFile(final File file, final String data)
public static void writeStringToFile(final File file, final String data)
//package com.java2s; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeStringToFile(final File file, final String data) { try {/*from www. ja v a 2s . c om*/ final OutputStream outputStream = new BufferedOutputStream( new FileOutputStream(file, false)); outputStream.write(data.getBytes("UTF-8")); outputStream.close(); } catch (IOException e) { throw new RuntimeException( "could not write file for debug cache", e); } } }