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.
Here is my solution which is calling a 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:
The meaning of “quickest” way is fastest writing in the file
Peter Lawrey wrote:
The speed at which you can obtain the data is almost certainly going to be 100x slower so this is likely to be fine for writing.
So it seems my solution which is showed in questions is fine.