What's the difference between those? I'm just learning Java ATM, but it seems like I can write to a file both ways i.e. (I didn't copy the try-catch block here.)
FileWriter file = new FileWriter("foo.txt");
file.write("foobar");
file.close();
and
FileWriter file = new FileWriter("foo.txt");
BufferedWriter bf = new BufferedWriter(file);
bf.write("foobar");
bf.close();
I understand the concept of buffering the data first, so does that mean the first example writes the characters one by one and the second first buffers it to the memory and writes it once?
write
returns , does java guarantee that the content is flush in disk OR just in pagecache which os will flush when needed? – Cattycornered