Write a text file
Method of writing textfiles.
This method writes the content based on the path and filename.
import java.io.*;
...
public void writeFile(String path, String filename, String content){
BufferedWriter bufferedwriter = null;
String seperator = System.getProperty("file.separator");
PrintWriter printwriter = null;
try{
bufferedwriter = new BufferedWriter(
new FileWriter(path+seperator+filename));
printwriter = new PrintWriter(bufferedwriter);
printwriter.println(content);
}catch(IOException ex){
ex.printStackTrace();
}finally{
printwriter.close();
}
}