I use the file as a cache for big data. One thread writes to it sequentially, another thread reads it sequentially.
Can I be sure that all the data that was written (using the write() method in one stream can be read() from another stream, provided that the “occurs before” relationship is correct from the point of view of the Java memory model? Is this behavior documented?
In my JDK, FileOutputStream does not override flush() , and OutputStream.flush() empty. That's why I wonder ...
The threads in question belong exclusively to a class that I have full control over. Each thread is guaranteed to be available only to one thread. My tests show that this works as expected, but I'm still wondering if this is guaranteed and whether this is documented.
See also this related discussion .
krlmlr
source share