Hi,
in my experience, READ-FILE-INTO-{STRING,BYTE-VECTOR} are very handy. However, maybe half of the time I already receive an open stream and need something like R-F-I-{S,B-V} but for streams.
I already submitted the attached patch in mid 2012. Nikodemus didn't want to introduce new functions at that time. Please consider it again.
The patch adds the functions COPY-STREAM-CONTENT-INTO-{STRING,BYTE-VECTOR} which implement this feature. Despite the new toplevel functions, little new code is introduced since R-F-I-{S,B-V} can be implemented in terms of the new functions.
Thanks in advance and kind regards, Jan
On Sun, 2014-10-05 at 13:17 +0200, Jan Moringen wrote:
The patch adds the functions COPY-STREAM-CONTENT-INTO-{STRING,BYTE-VECTOR} which implement this feature. Despite the new toplevel functions, little new code is introduced since R-F-I-{S,B-V} can be implemented in terms of the new functions.
I missed that COPY-STREAM-CONTENT-INTO-BYTE-VECTOR called FILE-LENGTH, pretty much defeating its purpose. Attached is an improved version that is as efficient as before when the stream length is known and geometrically grows the output buffer otherwise.
Sorry and kind regards, Jan
dear hackers,
FYI, i'm planning to push a fresh version of this. whoever doesn't want that to happen, please speak up!
(at one point there was a discussion about another project/repo, that would be less minimalist than alexandria, and that these stream/file operations should maybe go there)
alexandria-devel@common-lisp.net