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

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Thu Sep 9 07:01:10 UTC 2021


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.

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

Commit messages:
 - [PATCH] Use ByteArrayOutputStream.toString to convert its content to the String

Changes: https://git.openjdk.java.net/jdk/pull/5355/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5355&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8273528
  Stats: 6 lines in 4 files changed: 0 ins; 1 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5355.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5355/head:pull/5355

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



More information about the security-dev mailing list