RFR: 8273528: Avoid ByteArrayOutputStream.toByteArray when converting stream to String

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Thu Sep 9 16:04:07 UTC 2021


On Thu, 2 Sep 2021 20:19:40 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

> Using `ByteArrayOutputStream.toString` to convert it's content to a String is cleaner than `new String(out.toByteArray())`. Also it's a bit faster because of one less array copy.

Nice catch.  The update looks safe and good to me.  Thanks!

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

Marked as reviewed by xuelei (Reviewer).

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


More information about the security-dev mailing list