RFR: 8284638: store skip buffers in InputStream Object [v3]

Roger Riggs rriggs at openjdk.java.net
Wed Apr 13 16:05:18 UTC 2022


On Wed, 13 Apr 2022 14:56:12 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> @jmehrens what about this then?
>> I think it safe now(actually this mechanism is learned from Reader)
>
> XenoAmess has updated the pull request incrementally with one additional commit since the last revision:
> 
>   moving nr declaration from the beginning of the method to where it's actually used

I'd be a quite cautious about the slippery slope of incremental change with very little measurable benefit.
Most applications reading InputStreams or Readers are using the buffered versions that already
handle skip. These are the fallback versions.
Except for the buffered versions, the lower level InputStreams can do a better job of skip
then at the higher level built on read().  FileInputStream directly uses seek, other direct streams
can probably do a more efficient skip() by reading into private buffers. For example low level I/O for networking already reads into private buffers.  But the dominate case is still the buffered streams and readers.

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

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


More information about the core-libs-dev mailing list