Here you can find the source of save(String text, File out)
Parameter | Description |
---|---|
text | text of the file |
out | file location |
Parameter | Description |
---|---|
IOException | IO errors |
public static void save(String text, File out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; public class Main { /**/*w w w .j a v a2 s .com*/ * Creates file with given text * @param text text of the file * @param out file location * @throws IOException IO errors */ public static void save(String text, File out) throws IOException { BufferedWriter bw = new BufferedWriter( new OutputStreamWriter(new DataOutputStream(new FileOutputStream(out)))); bw.write(text); bw.close(); } }