> Here's what I have so far:
> <https://github.com/lassik/archive-srfis/tree/master/implementation>
Does anyone have a better solution for reading data from the archive
than this:
(read-archive-entry
archive entry
(lambda (read-bytevector!*)
(let ((bytes (make-bytevector 65536 0)))
(let loop ()
(let ((nread (read-bytevector!* bytes)))
(cond ((> nread 0)
(display "read ")
(display nread)
(display " bytes")
(newline)
(loop))))))))
So user-supplied lambda reads the contents of a file inside the archive
by repeatedly calling the procedure `read-bytevector!*`. That procedure
is a closure made by the archive library and does whatever is needed to
fill the given bytevector with some more data from the file.
It would be nice to use an ordinary byte input stream to represent the
decompressed contents of a file inside the archive, but I haven't heard
of any reasonably portable way to make custom streams like that. Common
Lisp is in the same predicament (there's Gray streams, which are pretty
widely implemented, but not standard).
Given the situation, is that `read-bytevector!*` solution the best way
to go about it?