Hello, Let me know what will happene in this scenario: If I am writing to a file around 100 kb of data using a IOStream. But while writing I am pausing for some time after writing 2kb of data. Suppose if the user tries to open a file in between i.e. before 100 kb is written then will the user see any data. I am not using any kind of buffers. The main question is whether we can view the data before the stream is closed. Please let me know. S Rao
It's very possible. Some programs will honor the fact that the file is open for writing and won't let you open it. Others will let you open it for read-only access. It depends on the program and the operating system you are running. Every file write that the java VM makes goes to an underlying Operating System file buffer. The operating system will flush it to disk periodically as it becomes full. This will continue as long as you are writing to the file in java. So the OS file will keep getting bigger on disk as more data is added to it. Again, if you open it with a text editor that supports opening a file marked "open for writing" then you will be able to see the data in the file as it was when it was opened.