kotlinx-io
kotlinx-io copied to clipboard
Missing API: `Sink.write(CharSequence)`
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.