KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What happens when you concurrently open two (or more) FileOutputStreams on the same file? The Java API says this: Some platforms, in particular, allow a file to be opened for writing by only one FileOutputStream (or other file-writing object) at a time. I'm guessing Windows isn't such a platform, because I have two threads that read some big file (each one a different one) then write it to the same output file. No exception is thrown, the file is created and seems to contain chunks from both input files. Side questions: Is this true for Unix, too? And since I want the behaviour to be the same (actually I want one thread to write correctly and the other to be warned of the conflict), how can I determine that the file is already opened for writing?
Tags (comma-separated)
Save Edits
Cancel