On Mon, 11 Dec 2023 13:56:50 GMT, Sergey Tsypanov <stsypa...@openjdk.org> wrote:

>> It looks like we can skip copying of `byte[]` in 
>> `BufferedInputStream.implTransferTo()` for `OutputStreams` residing in 
>> `java.io`.
>> 
>> See comment by @vlsi in 
>> https://github.com/openjdk/jdk/pull/10525/files#diff-e19c508d1bb6ee78697ecca66947c395adda0d9c49a85bf696e677ecbd977af1R612
>
> Sergey Tsypanov has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 11 additional 
> commits since the last revision:
> 
>  - Merge branch 'master' into 8320971
>  - 8320971: Rename method
>  - 8320971: Extract utility class
>  - 8320971: Rearrange code
>  - 8320971: Rewrite comment
>  - 8320971: Use same approach as BAOS
>  - Merge branch 'master' into 8320971
>  - 8320971: Add test
>  - 8320971: Trust any OutputStream from java.*
>  - 8320971: Use BufferedInputStream.class.getPackageName()
>  - ... and 1 more: https://git.openjdk.org/jdk/compare/c3f8beba...2df52c72

With small changes I am +1 ! :-)

src/java.base/share/classes/java/io/ByteArrayInputStream.java line 212:

> 210:             // 'tmpbuf' is null if and only if 'out' is trusted
> 211:             byte[] tmpbuf;
> 212:             if (IOStreams.isTrusted(out))

IMHO we should use `IOStreams.isTrusted(out)` in BAIS, too.

src/java.base/share/classes/java/io/IOStreams.java line 1:

> 1: /*

Please fix Whitespace errors. Thanks. :-)

src/java.base/share/classes/java/io/IOStreams.java line 26:

> 24:  */
> 25: 
> 26: package java.io;

As this class is implementation-specific to OpenJDK, we should move it into the 
`com.sun` namespace.

src/java.base/share/classes/java/io/IOStreams.java line 39:

> 37:      * <pre>
> 38:      * - the reference to {@code byte[]} is not kept within the class
> 39:      * - the argument of {@link OutputStream#write(byte[])}} and {@link 
> OutputStream#write(byte[], int, int)}} is not modified within the methods

`- the byte[] is not read outside of the given bounds`

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

Marked as reviewed by mk...@github.com (no known OpenJDK username).

PR Review: https://git.openjdk.org/jdk/pull/16879#pullrequestreview-1775343572
PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1422602610
PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1422596506
PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1422601767
PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1422598809

Reply via email to