-
Bug
-
Resolution: Fixed
-
P3
-
7, 12.0.1
-
b05
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8267158 | 13.0.8 | Yuri Nesterenko | P3 | Resolved | Fixed | b02 |
JDK-8268760 | 11.0.13-oracle | Ravi Reddy | P3 | Resolved | Fixed | b02 |
JDK-8267533 | 11.0.12 | Brian Burkhalter | P3 | Resolved | Fixed | b04 |
Ranged HTTP requests (https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) may require implementations to use `InputStream.skip(int)` to skip to the requested range.
java.io.FileInputStream.skip(int) implementation is native and uses "seek" primitives that are very efficient.
On the contrary, Files.newInputStream(...) returns a `sun.nio.ch.ChannelInputStream` whose `skip(int)` implementation (inherited from `InputStream`) is to read and discard using 2 KiB buffers, which is very inefficient for large files (where ranged HTTP requests are more likely to be used).
`ChannelInputStream` could override `skip(int)` and check if the channel is a `SeekableByteChannel`, as it is already done for `available()`.
java.io.FileInputStream.skip(int) implementation is native and uses "seek" primitives that are very efficient.
On the contrary, Files.newInputStream(...) returns a `sun.nio.ch.ChannelInputStream` whose `skip(int)` implementation (inherited from `InputStream`) is to read and discard using 2 KiB buffers, which is very inefficient for large files (where ranged HTTP requests are more likely to be used).
`ChannelInputStream` could override `skip(int)` and check if the channel is a `SeekableByteChannel`, as it is already done for `available()`.
- backported by
-
JDK-8267158 (fs) Files.newInputStream(...).skip(n) is slow
- Resolved
-
JDK-8267533 (fs) Files.newInputStream(...).skip(n) is slow
- Resolved
-
JDK-8268760 (fs) Files.newInputStream(...).skip(n) is slow
- Resolved
- relates to
-
JDK-8227609 (fs) Files.newInputStream(...).skip(n) should allow skipping beyond file size
- Resolved
- links to
-
Commit openjdk/jdk13u-dev/0b0db80d
-
Review openjdk/jdk13u-dev/209
-
Review openjdk/jdk13u-dev/210
(3 links to)