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
On Sat, 06 Jan 2007 22:34:18 -0800, Chris Dean ctdean@sokitomi.com wrote:
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.
Thanks for the patch. This is in 0.10.0 now.
I use flexi-streams all the time. A great package! Thanks for all your hard work on it.
You're welcome... :)
flexi-streams-devel@common-lisp.net