Flush on Java application exit
Suppose a Java application writes to a file using BufferedWriter API (and
does not call flush after every write). I guess that if the application
exits with System.exit the buffer is mot flushed and the file may be
corrupted.
Suppose also that the application component, which decides to exit, is not
aware about the component, which writes to the file?
What is the easiest and correct way to solve this problem?
No comments:
Post a Comment