Here you can find the source of writeFile(File path, File file, String content)
content
to file
using BufferedWriter.
Parameter | Description |
---|---|
file | a parameter |
content | a parameter |
public static void writeFile(File path, File file, String content)
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { /**/*from w w w . ja va 2 s . c o m*/ * Write <code>content</code> to <code>file</code> using BufferedWriter. * @param file * @param content */ public static void writeFile(File path, File file, String content) { try { if (!path.isDirectory()) { path.mkdir(); } BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.write(content); writer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }