Here you can find the source of writeTextFile(String path, String text)
Parameter | Description |
---|---|
path | File to write |
text | File contents |
Parameter | Description |
---|---|
IOException | in case of failure |
public static void writeTextFile(String path, String text) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.FileWriter; import java.io.IOException; public class Main { /**/*from w ww .j av a2s . c o m*/ * Writes the contents of a String to a file. * <p> * Notes: - file will have the system default encoding * * @param path File to write * @param text File contents * @throws IOException in case of failure */ public static void writeTextFile(String path, String text) throws IOException { FileWriter writer = new FileWriter(path, false); writer.write(text); writer.close(); } }