TJ Atkins <JackalMage@gmail.com> wrote:
+---------------
| Kenneth Tilton <kentil...@gmail.com> wrote:
| > Lisp doesn't even have a library to compress a string for interweb
| > transmission. I bet Ruby and F# and Clojure and Qi and Lisp have one.
|
| The most obvious thing to roll out of a google search is
| http://common-lisp.net/project/gzip-stream/.
+---------------
The most obvious thing to roll out of my netnews archives was this:
Newsgroups: comp.lang.lisp
Subject: inflate implementation (new opensource module)
From: John Foderaro <jkf@unspamx.franz.com>
Date: Mon, 12 Nov 2001 16:58:03 -0800
Message-ID: <MPG.165a0fe4e60cab2f98971d@news.dnai.com>
I've just published the code to Inflate a byte stream
compressed by the Deflate algorithm. Deflate is
ths most common compression algorithm used in zip files
and jar files. It is also the compression algorithm
used by gzip.
I have code to add this inflator to a simple-stream
via encapsulation, and I'll be releasing that in a few weeks.
Details and code can be found here:
http://opensource.franz.com/deflate/index.html
I've only tested in on ACL 6.0 and ACL 6.1.
...
and this:
Newsgroups: comp.lang.lisp
Subject: Re: Q: easy to use, efficient code for reading ZIPed or GZIPed text files?
From: David Lichteblau <usenet-2006@lichteblau.com>
Date: 15 Aug 2007 16:50:36 GMT
Message-ID: <slrnfc6bmu.au9.usenet-2006@radon.home.lichteblau.com>
...
Put the following code into the package Franz' inflate routines are in.
(For example using the ZIP package, which includes inflate.cl.)
Use like this:
(with-open-file (s "passwd.gz" :element-type '(unsigned-byte 8))
(zip::skip-gzip-header s)
(let ((r (flexi-streams:make-flexi-stream (zip::make-inflate-stream s))))
(loop for line = (read-line r nil)
while line
do (print line))))
"root:x:0:0:root:/root:/bin/bash"
"daemon:x:1:1:daemon:/usr/sbin:/bin/sh"
"bin:x:2:2:bin:/bin:/bin/sh"
"sys:x:3:3:sys:/dev:/bin/sh"
...
;;;; (c) David Lichteblau, X11-style license
(in-package :zip)
(defclass inflate-stream
(trivial-gray-stream-mixin fundamental-binary-input-stream)
... )
...[remainder elided, see original article for full text]...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607