I have a need in my code to use in-memory streams that read and write from strings using read-byte and write-byte. I could convert back and forth using octets-to-string and string-to-octets. For example:
(octets-to-string (with-output-to-sequence (out) (write-byte 65 out))) => "A"
But I wish to avoid the garbage created by this conversion process.
I propose an addition to flexi-streams that allows in-memory streams to use a function to transform each byte as it is written and read from a sequence. For example:
(with-output-to-sequence (out :element-type 'base-char :byte-transformer #'code-char) (write-byte 65 out)) => "A"
with-input-from-sequence has a similar change.
A patch is attached. Comments and request for changes welcome.
I use flexi-streams all the time. A great package! Thanks for all your hard work on it.
Cheers, Chris Dean