Here you can find the source of writeString(File file, String string)
public static void writeString(File file, String string)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void writeString(File file, String string) { FileOutputStream fos = null; try {/*from ww w . j a va 2 s. c o m*/ fos = new FileOutputStream(file, false); fos.write(string.getBytes("UTF-8")); } catch (Exception e) { } finally { close(null, fos); } } private static void close(InputStream is, OutputStream os) { if (is != null) try { is.close(); } catch (IOException e) { } if (os != null) try { os.close(); } catch (IOException e) { } } }