Java BufferedWriter close() [英] Java BufferedWriter close()
问题描述
operation1();
bw.close();
operation2();
当我调用 BufferedReader.close()
从我的代码,我假设我的JVM进行系统调用,确保缓冲区已被刷新并写入磁盘。我想知道是否 close()
等待系统调用来完成它的操作,或者是否继续到 operation2()
不用等待 close()
来完成。
为了解释我的问题,当我做 operation2()
,我可以假设 bw.close()
已经成功完成了吗?
当我操作2()时,我可以假设bw.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?
when I do operation2(), can I assume that bw.close() has completed successfully?
Yes
这篇关于Java BufferedWriter close()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!