Is FileOutputStream thread safe?

Is FileOutputStream thread safe?
Answer
No.
Java does not support streaming to the same stream from multiple threads. He explains things well and has some sample code for a ThreadedOutputStream , which would do what you want. If you’re interested only in writing to a stream concurrently and don’t care about ordering, you can have buffers for each thread.
 

Tìm kiếm

Back
Top