8316681: Rewrite URLEncoder.encode to use small reusable buffers

Reviewed-by: dfuchs, rriggs
This commit is contained in:
Claes Redestad 2023-09-22 09:41:01 +00:00
parent bd2439f3fc
commit c24c66db97
4 changed files with 82 additions and 19 deletions

View file

@ -679,9 +679,8 @@ public final class HexFormat {
* @throws UncheckedIOException if an I/O exception occurs appending to the output
*/
public <A extends Appendable> A toHexDigits(A out, byte value) {
Objects.requireNonNull(out, "out");
try {
out.append(toHighHexDigit(value));
out.append(toHighHexDigit(value)); // implicit null-check
out.append(toLowHexDigit(value));
return out;
} catch (IOException ioe) {