Quickest way to write to file in java
- by user1097772
I'm writing an application which compares directory structure. First I wrote an application which writes gets info about files - one line about each file or directory.
My soulution is:
calling method toFile
Static PrintWriter pw = new PrintWriter(new BufferedWriter( new FileWriter("DirStructure.dlis")), true);
String line; // info about file or directory
public void toFile(String line) {
pw.println(line);
}
and of course pw.close(), at the end.
My question is, can I do it quicker? What is the quickest way?
Edit:
quickest way = quickest writing in the file