RFR: 8341666: FileInputStream doesn't support readAllBytes() or readNBytes(int) on pseudo devices [v2]

Alan Bateman alanb at openjdk.org
Fri Oct 25 11:20:10 UTC 2024


On Thu, 24 Oct 2024 15:13:57 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>>> [...] do you think we should reduce these native calls in this change and call `canSeek()` just once [...]
>> 
>> I think that is a good idea but I would think it best to do i in a similar way to the recent change to `ChannelInputStream` that added `isOther`.
>
>> I think the main thing with this PR is whether canSeek is the right thing to use.
> 
> `canSeek` is really the same as `isOther` in the recent `Files.newInputStream` change, but given that on Windows the result of the function is always `true`, the naming `isOther` (which would always return `false`) did not seem apropos.

I think it would be limit to limit is to regular files, in which case canSeek could be isRegularFile and just check S_ISREG. The Windows implementation that just assume it's a regular file until there is a better implementation. Up to you but I think it would make it much clearer. Longer time we need to re-target this to use FileChannelImpl but several issues to work through before then.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21673#discussion_r1816500743


More information about the core-libs-dev mailing list