On Tue, 1 Jul 2025 02:07:07 GMT, Brett Okken <[email protected]> wrote:
> > StreamEncoder has a ByteBuffer that acts as a buffer,
>
> At a fixed sized of 512 bytes which cannot be affected by size passed into
> the BufferedWriter?
So I added this method StreamEncoder::growByteBufferIfEmptyNeeded and called it
in the BufferedWriter constructor
private BufferedWriter(Writer out, int initialSize, int maxSize) {
// ...
if (out instanceof OutputStreamWriter w && w.se.getCharset() ==
UTF_8.INSTANCE) {
w.se.growByteBufferIfEmptyNeeded(initialSize);
this.impl = new OutputStreamWriterImpl(w);
}
// ...
}
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26022#issuecomment-3021479496