Here you can find the source of writeStringToFile(String s, File f)
Parameter | Description |
---|---|
s | The string to write |
f | The file to write to |
Parameter | Description |
---|
public static void writeStringToFile(String s, File f) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { /**//w ww . j av a 2s . c om * Writes a string to a file replacing the entire contents * * @param s The string to write * @param f The file to write to * @throws java.io.IOException */ public static void writeStringToFile(String s, File f) throws IOException { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(f)); bw.write(s); } finally { if (null != bw) { bw.close(); } } } }