Hello Botond,

"...which is very costly compared..."

Feel free to provide a PR on GitHub with your change and a JMH
benchmark to show this is indeed the case ;)

TY,
Gary

On Wed, Aug 20, 2025 at 6:31 PM Botond Kósa <botond.k...@gmail.com> wrote:
>
> Hi Commons IO Developers,
>
> I noticed that StringBuilderWriter currently (in version 2.20.0) overrides
> Writer methods write(char[], int, int) and write(String), but does not
> override write(int). This means that whenever write(int) is called on a
> StringBuilderWriter instance, it falls back to the implementation in
> Writer, which is very costly compared to simply appending a char to a
> StringBuilder.
>
> I suggest adding this method to StringBuilderWriter:
>
> @Override
> public void write(final int c) {
>     builder.append((char) c);
> }
>
> Thanks & regards,
> Botond Kósa
> botond.k...@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to