SNYP40A1
February 8th, 2010, 09:45 AM
I have implemented a function in Java which logs data to a text file using BufferedWriter. Periodically, I want to close the currently-opened text file and write my data to a new one depending on what the data to be written looks like. I have that part figured out, but how do I check to ensure that the stream is ready to be written (allowed enough time for the BufferedStream to be setup)? In C++, there's an is-open or good command one can call to ensure that the stream is ready (http://www.cplusplus.com/doc/tutorial/files/). For the buffered writer class in Java, is it safe to assume that once this line is called:
FileWriter fstream = new FileWriter("out.txt");
BufferedWriter out = new BufferedWriter(fstream);
It's safe to write to BufferedWriter out?
FileWriter fstream = new FileWriter("out.txt");
BufferedWriter out = new BufferedWriter(fstream);
It's safe to write to BufferedWriter out?