RFR: 8264777: Overload optimized FileInputStream::readAllBytes

Brian Burkhalter bpb at openjdk.java.net
Tue May 4 19:04:56 UTC 2021


On Tue, 4 May 2021 17:46:15 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/share/classes/java/io/FileInputStream.java line 342:
>> 
>>> 340: 
>>> 341:     private native long length() throws IOException;
>>> 342:     private native long position() throws IOException;
>> 
>> Can you confirm that you've tested with special files? It's very likely that there will be cases where lseek will fail.
>
> Only regular files this far. Are there any particular special files which would be of interest?

On `/proc/cpuinfo` for example, `fstat()` succeeds but `st_size` in `struct stat` is zero. The correct position is however returned by `lseek()`. Apparently this proposal needs to be reworked to expect size zero when the size is in fact non-zero.

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

PR: https://git.openjdk.java.net/jdk/pull/3845


More information about the core-libs-dev mailing list