RFR: 8233451: (fs) Files.newInputStream() cannot be used with character special files

Alan Bateman alanb at openjdk.org
Tue Oct 15 05:18:14 UTC 2024


On Mon, 14 Oct 2024 23:30:06 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add `isOther` and `available` methods to `FileChannelImpl` and the interfaces to native code and use these in `ChannelInputStream` to work around cases where a wrapped `FileChannelImpl` is not really seekable.

src/java.base/windows/native/libjava/io_util_md.h line 44:

> 42: WCHAR* currentDir(int di);
> 43: int currentDirLength(const WCHAR* path, int pathlen);
> 44: JNIEXPORT int handleAvailable(FD fd, jlong *pbytes);

This should not be exported.

src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c line 402:

> 400:     HANDLE handle = (HANDLE)(handleval(env, fdo));
> 401:     jlong available;
> 402:     if (handleAvailable((jlong)handle, &available)) {

Ugh, we shouldn't be using handleAvailable here. This native method needs to stand on its own.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21508#discussion_r1800469509
PR Review Comment: https://git.openjdk.org/jdk/pull/21508#discussion_r1800469147


More information about the nio-dev mailing list