On Tue, 9 Feb 2021 11:40:09 GMT, Philippe Marschall
<[email protected]> wrote:
>> Andrey Turbanov has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> 8080272: Refactor I/O stream copying to use java.io.InputStream.transferTo
>> fix review comments
>
> src/java.base/share/classes/java/util/jar/JarInputStream.java line 93:
>
>> 91: if (e != null &&
>> JarFile.MANIFEST_NAME.equalsIgnoreCase(e.getName())) {
>> 92: man = new Manifest();
>> 93: byte[] bytes = new BufferedInputStream(this).readAllBytes();
>
> I wonder if it makes sense to avoid reading the entire manifest into a byte[]
> when we don't need to verify the JAR. This may help avoiding some
> intermediate allocation and copying. This make be noticeable for some of the
> larger manifests (Java EE, OSGi, ...). A possible implementation may look
> like this
> https://github.com/marschall/jdk/commit/c50880ffb18607077c4da3456b27957d1df8edb7.
>
> In either case since we're calling #readAllBytes I don't see why we are
> wrapping in a BufferedInputStream rather than calling #readAllBytes directly.
Usage of `BufferedInputStream` removed
-------------
PR: https://git.openjdk.java.net/jdk/pull/1853