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

Sergey Kuksenko skuksenko at openjdk.java.net
Sun May 29 18:26:49 UTC 2022


On Tue, 24 May 2022 20:40:51 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:
> 
>   invert if; refine javadoc.

Another InputStreams cleaning direction.

Many InputStream subclasses have read(byte[],...) as a primary implementation. Somehow they should implement 1-byte reading (read()) via array reading. All imaginable strategies are used:
- allocate byte[1] per read() invocation
- cache byte[1] preallocated
- cache byte[1], allocation on demand
- share 1-byte read buffer and skip buffer, as preallocating and allocating on demand.
- etc

So cleaning and making consistent all 1-byte read implementations - also may be valuable.

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

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


More information about the core-libs-dev mailing list