kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

Missing API: `Sink.write(CharSequence)`

Open joffrey-bion opened this issue 1 year ago • 0 comments
trafficstars

At the moment, when receiving data from a mutable CharSequence, one has to use sink.writeString(chars.toString()), which may be inefficient (copying data to create a String, just to then encode it again as UTF-8 bytes in the buffer).

It would be nice to have a Sink.write(CharSequence) (or Sink.writeUtf8(CharSequence)) extension so we can efficiently transfer characters from a CharSequence into a Buffer via UTF-8 encoding.

joffrey-bion avatar Feb 14 '24 01:02 joffrey-bion