On Fri, 27 Jun 2025 16:48:40 GMT, Shaojin Wen <s...@openjdk.org> wrote:
> BufferedWriter -> OutputStreamWriter -> StreamEncoder > > In this call chain, BufferedWriter has a char[] buffer, and StreamEncoder has > a ByteBuffer. There are two layers of cache here, or the BufferedWriter layer > can be removed. And when charset is UTF8, if the content of write(String) is > LATIN1, a conversion from LATIN1 to UTF16 and then to LATIN1 will occur here. > > LATIN1 -> UTF16 -> UTF8 > > We can improve BufferedWriter. When the parameter Writer instanceof > OutputStreamWriter is passed in, remove the cache and call it directly. In > addition, improve write(String) in StreamEncoder to avoid unnecessary > encoding conversion. src/java.base/share/classes/sun/nio/cs/StreamEncoder.java line 3: > 1: /* > 2: * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights > reserved. > 3: * Copyright (c) 2054, Alibaba Group Holding Limited. All Rights Reserved. `Copyright (c) 2054` should be `Copyright (c) 2025` ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26022#discussion_r2174234524