Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java BufferedWriter close()

Assume that I have the following code fragment:

operation1();
bw.close();
operation2();

When I call BufferedReader.close() from my code, I am assuming my JVM makes a system call that ensures that the buffer has been flushed and written to disk. I want to know if close() waits for the system call to complete its operation or does it proceed to operation2() without waiting for close() to finish.

To rephrase my question, when I do operation2(), can I assume that bw.close() has completed successfully?

like image 487
rakeshr Avatar asked Dec 02 '22 05:12

rakeshr


1 Answers

when I do operation2(), can I assume that bw.close() has completed successfully?

Yes

like image 89
OscarRyz Avatar answered Dec 06 '22 09:12

OscarRyz