On Fri, 1 Jul 2022 08:06:10 GMT, Сергей Цыпанов <d...@openjdk.org> wrote:
> In case we read all bytes from an InputStream we don't need wrapping with > BufferedInputStream as the bytes are not written into internal buffer. With > removal of redundant buffer we save 8 kB of allocated memory. I believe that in that case the bytes might get double buffered, depending on whether the buffer used by `readAllBytes` is bigger than the buffer used by `BufferedInputStream`, since IIAMNM `readAllBytes()` will call `read(byte[], off, len)` - but I otherwise agree that regardless of that wrapping in a `BufferedInputStream` is always wasteful in this case. Good find! ------------- PR: https://git.openjdk.org/jdk/pull/9343