Quickest way to write to file in java
Posted
by
user1097772
on Stack Overflow
See other posts from Stack Overflow
or by user1097772
Published on 2012-04-14T22:54:23Z
Indexed on
2012/04/14
23:31 UTC
Read the original article
Hit count: 270
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
© Stack Overflow or respective owner