Here you can find the source of writeTextToFile(String file, String text)
Parameter | Description |
---|---|
file | The filename (with full path) to write to |
text | Text to write to the file |
public static final void writeTextToFile(String file, String text)
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class Main { /**/* w ww . j a v a2s .co m*/ * Simple method to write text to a file * @param file The filename (with full path) to write to * @param text Text to write to the file */ public static final void writeTextToFile(String file, String text) { try { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.write(text); writer.close(); } catch (IOException e) { e.printStackTrace(); } } }