File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Output to a File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Output to a File" Watch "Output to a File" New topic
Author

Output to a File

s rao
Greenhorn

Joined: Mar 12, 2002
Posts: 15
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
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
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.


Rob
SCJP 1.4
s rao
Greenhorn

Joined: Mar 12, 2002
Posts: 15
Thanks Ross.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Output to a File
 
Similar Threads
Design issue on data entry
Write file to a client system
allow upload txt files only
How to Download a File
upload txt files only