[RFC] 4950302: (fs spec) Random write produces different results on Linux vs Windows from same .class
Alan Bateman
Alan.Bateman at oracle.com
Wed Nov 20 15:01:48 UTC 2019
On 20/11/2019 13:09, David Lloyd wrote:
> If toggling the mode is unacceptable, an
> also-not-so-great-but-should-work alternative workaround would be to
> open `/proc/self/fd/<fdnum>` and write to that (basically this works
> more or less like dup() but doesn't share file offset and flags).
> Then you're not toggling file modes - though it will of course fail if
> you run out of file descriptors.
>
Toggling the mode should be okay if a workaround is really needed but it
has to be coordinated in the FileChannel implementation as that it can
be coordinated with other operations. That will also avoid putting a
potentially costly check in the positional write method too.
-Alan
More information about the nio-dev
mailing list