RFR: 8285445: cannot open file "NUL:"
David M. Lloyd
duke at openjdk.java.net
Mon Apr 25 13:32:49 UTC 2022
On Sat, 23 Apr 2022 15:24:13 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> > FWIW we fixed the same problem by simply using `NUL` instead of `NUL:`.
>
> Hopefully newer code can use OutputStream.nullOutputStream(). It's portable and avoids depending on these legacy Windows specific reserved names.
One possible advantage of having a "real" OS-supported `null` stream (in addition to its uses by the process subsystem) is that it could be used to efficiently drain bytes from things like sockets and pipes using transfer methods, assuming adequate JDK support. On Linux at least, the `splice` syscall is able to move bytes between socket and pipe buffers and into file buffers without copying them into user space. For `/dev/null` this means the bytes are discarded on the kernel side.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8373
More information about the core-libs-dev
mailing list