[OpenJDK 2D-Dev] RFR: 8263560: Remove needless wrapping with BufferedInputStream
github.com+10835776+stsypanov at openjdk.java.net
Sun Mar 14 17:09:21 UTC 2021
On Sun, 14 Mar 2021 07:51:24 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> In some cases wrapping of `InputStream` with `BufferedInputStream` is redundant, e.g. in case the wrapped one is `ByteArrayOutputStream` which does not require any buffer having one within.
>> Other cases are related to reading either a byte or short `byte`: in both cases `BufferedInputStream.fill()` will be called resulting in load of much bigger amount of data (8192 by default) than required.
> src/java.base/share/classes/jdk/internal/jmod/JmodFile.java line 57:
>> 55: // validate the header
>> 56: byte magic = new byte;
>> 57: in.read(magic);
> While you are there, this can be changed to magic = in.readNBytes(4) and throw IOException if magic.length != 4.
More information about the 2d-dev