Here you can find the source of stringToFile(final String s, final File f, final Charset c)
public static void stringToFile(final String s, final File f, final Charset c) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.charset.Charset; public class Main { public static void stringToFile(final String s, final File f, final Charset c) throws IOException { byteArrayToFile(s.getBytes(c), f); }// w w w . j av a 2s . c o m public static void byteArrayToFile(final byte[] b, final File f) throws IOException { final FileOutputStream fos = new FileOutputStream(f); fos.write(b); fos.close(); } }