RFR: 8279283 - BufferedInputStream should override transferTo [v5]

Daniel Fuchs dfuchs at openjdk.java.net
Wed Jan 12 13:28:25 UTC 2022


On Mon, 27 Dec 2021 13:43:12 GMT, Markus KARG <duke at openjdk.java.net> wrote:

>> Implementation of JDK-8279283
>
> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed missing BufferedInputStream

src/java.base/share/classes/java/io/BufferedInputStream.java line 501:

> 499:         return avail + getInIfOpen().transferTo(out);
> 500:     }
> 501: 

Hi Markus, did you double check with all the existing subclasses of `BufferedInputStream` that the new implementation of `transferTo` will not cause trouble, if any of the subclasses is overriding `int read(byte[] b, int off, int len)`? If I'm not mistaken - with this new implementation of `transferTo` then `BufferedInputStream::read(byte[] b, int off, int len)` (a public method that can be overridden) will no longer be called by `transferTo`. This could be causing problems if `read` is overriden to do some special processing in the subclass.

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

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


More information about the core-libs-dev mailing list