Switch branches/tags
release10.1_t6 release10.1_t5 release10.1_t4 release10.1_t3 release10.1_t2 release10.1_t1 release10.1_release_point release10.1_rc5 release10.1_rc4 release10.1_rc3 release10.1_rc2 release10.1_rc1 release10.1_beta3_release_point release10.1.beta2_release_point release10.1.beta_t6 release10.1.beta_t5 release10.1.beta_t4 release10.1.beta_t3 release10.1.beta_t2 release10.1.beta_t1 release10.1.beta_release_point release10.1.beta_rc4 release10.1.beta_rc3 release10.1.beta_rc2 release10.1.beta_rc1 release10.0_t3 release10.0_t2 release10.0_t1 release10.0_rc9 release10.0_rc8 release10.0_rc7 release10.0_rc6 release10.0_rc5 release10.0_rc4 release10.0_rc3 release10.0_rc2 release10.0_rc1 release10.0.pre-final.30_release_point release10.0.pre-final.17_release_point release10.0.beta_t13 release10.0.beta_t12 release10.0.beta_t11 release10.0.beta_t10 release10.0.beta_t9 release10.0.beta_t8 release10.0.beta_t7 release10.0.beta_t6 release10.0.beta_t5 release10.0.beta_t4 release10.0.beta_t3 release10.0.beta_t2 release10.0.beta_t1 release10.0.beta_release_point release10.0.beta_rc2 release10.0.beta_rc1 release_aclt2 release_acl100b14t8 release_acl100b11t7 release_acl100b10t6 release_acl100b8t5 release_acl100b7t4 release_acl100b6t3 release_acl100b4t2 release_acl100b2t1 release_acl90b21rc5 release_acl90b20_release_point release_acl90b20rc4 release_acl90b19rc3 release_acl90b18rc2 release_acl90b15_release_point release_acl90b15rc1 release_acl90b13t1 release_acl90b11t1 release_acl90b9t1 release_acl90b8t1 release_acl90b6_release_point release_acl90b6rc2 release_acl90b_release_point release_acl90a52rc1 release_acl90a44rc2 release_acl90a43rc1 release_acl90a39 release_acl90a39rc2 release_acl90a32 release_acl90a27 release_acl90a25 release_acl90a24 release_acl90a23 release_acl90a20 release_acl90a18 install-spider_2013-04-26T12-55-31 install-spider_2013-04-25T12-56-58 install-spider_2013-04-24T16-52-55 install-spider_2013-04-24T16-42-42 install-spider_2013-04-24T16-29-36 install-spider_2013-04-24T15-47-16 install-spider_2013-04-24T15-37-01 install-spider_2013-04-24T15-02-09 install-spider_2013-04-23T11-10-35 install-spider_2013-04-12T14-51-27
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
140 lines (75 sloc) 3.4 KB
deflate module documentation
[this is temporary until the documentation is property formatted
and merged with other documentation]
The deflate module provides a stream interface to the widely
available libz compression library. libz is not included and is
assumee to be on your machine.
Functions are in the package.
The module exports
This module implements the deflate-stream. A deflate-stream
accepts characters and byte and causes them to be compressed
and sent to a target.
The target can either another stream, or it can be a vector.
In the case of a vector the deflate-stream will collect the
complete deflation of what is written to it in a sequence of
vectors, initially using the vector passed in as the target and
then allocating new vectors as necessary.
(make-instance 'deflate-stream :target target-spec :compression compress-spec)
The target-spec is a stream or a simple vector element type (unsigned-byte 8).
The compress-spec is either :gzip or :deflate (where :gzip is the default).
:gzip is the preferred format as the result can be uncompressed with
the inflate-stream (be sure to specify :skip-gzip-header t to the
make-instance of inflate-stream). The :gzip format output can
also be uncompressed with the gunzip program fount on Unix.
Stream as a target-spec
If you pass a stream as the target-spec then as you write characters
and bytes to the deflate-stream, the bytes resulting from deflation
will be written to the given stream. There is a lot of buffering
going on in this stream and the compression library. Therefore you
may not see the results in your target-spec stream immeidately.
When you close the deflate-stream the last bytes in all the buffers
will be sent through deflation and the end of deflation record will
be written to the target-spec stream.
The target-spec stream will NOT be closed. It is the callers responsibility
to close the stream passed in as the target-spec
The function
(deflate-target-stream deflate-stream)
will return that target-spec stream used by the deflate-stream
Octet vector as a target-spec
Passing a simple vector of type (unsigned-byte 8) as the target-spec
is telling the deflate-stream that you wish to collect the deflation
result in vectors in the lisp heap.
After you close the deflate-stream you can retrieve the result of
deflation in one of two ways:
(deflate-stream-vector-combined deflate-stream)
returns two values
1. octet vector
2. number of bytes of actual data
this says that the result of deflation is found in the first N bytes
of the vector returned by the first value. The second value returned is N.
(deflate-stream-vector deflate-stream)
returns three values
1. the newest vector
2. the number of byte of actual data in the newest vector
3. a list of previous vectors holding data in reverse order
for example if the three returned values were
(c b a)
then the deflated result is found by combining in this order:
all of a
all of b
all of c
the first 100 bytes of v
The deflate-stream-vector-combined function does the combination
described above to produce its results. This results in
a new vector allocation and then copying that wouldn't be necessary
if you're prepared to work with the raw results from deflate-stream-vector