Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libzlib.tex @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | ef8a15902a48 |
| children | 3468ea8645ca |
| rev | line source |
|---|---|
| 5387 | 1 \section{Built-in Module \sectcode{zlib}} |
| 2 \bimodindex{zlib} | |
| 3 | |
| 4 For applications that require data compression, the functions in this | |
|
5390
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
5 module allow compression and decompression, using the zlib library, |
|
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
6 which is based on GNU zip. The zlib library has its own home page at |
|
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
7 \code{http://www.cdrom.com/pub/infozip/zlib/}. |
|
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
8 Version 1.0.4 is the most recent version as of April 30, 1997; use a |
|
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
9 later version if one is available. |
| 5387 | 10 |
| 11 The available functions in this module are: | |
| 12 | |
| 13 \renewcommand{\indexsubitem}{(in module zlib)} | |
| 14 \begin{funcdesc}{adler32}{string\optional{\, value}} | |
| 15 Computes a Adler-32 checksum of \var{string}. (An Adler-32 | |
| 16 checksum is almost as reliable as a CRC32 but can be computed much | |
| 17 more quickly.) If \var{value} is present, it is used as the | |
| 18 starting value of the checksum; otherwise, a fixed default value is | |
| 19 used. This allows computing a running checksum over the | |
| 20 concatenation of several input strings. The algorithm is not | |
| 21 cryptographically strong, and should not be used for | |
| 22 authentication or digital signatures. | |
| 23 \end{funcdesc} | |
| 24 | |
| 25 \begin{funcdesc}{compress}{string\optional{\, level}} | |
| 26 Compresses the data in \var{string}, returning a string contained | |
| 27 compressed data. \var{level} is an integer from 1 to 9 controlling | |
| 28 the level of compression; 1 is fastest and produces the least | |
| 29 compression, 9 is slowest and produces the most. The default value is | |
|
5676
ef8a15902a48
Fix a sentence which ends "...is 6, which." (AMK)
Guido van Rossum <guido@python.org>
parents:
5390
diff
changeset
|
30 6. Raises the \code{zlib.error} exception if any error occurs. |
| 5387 | 31 \end{funcdesc} |
| 32 | |
| 33 \begin{funcdesc}{compressobj}{\optional{level}} | |
| 34 Returns a compression object, to be used for compressing data streams | |
| 35 that won't fit into memory at once. \var{level} is an integer from | |
| 36 1 to 9 controlling the level of compression; 1 is fastest and | |
| 37 produces the least compression, 9 is slowest and produces the most. | |
| 38 The default value is 6. | |
| 39 \end{funcdesc} | |
| 40 | |
| 41 \begin{funcdesc}{crc32}{string\optional{\, value}} | |
| 42 Computes a CRC (Cyclic Redundancy Check) sum of \var{string}. If | |
| 43 \var{value} is present, it is used as the starting value of the | |
| 44 checksum; otherwise, a fixed default value is used. This allows | |
| 45 computing a running checksum over the concatenation of several | |
| 46 input strings. The algorithm is not cryptographically strong, and | |
| 47 should not be used for authentication or digital signatures. | |
| 48 \end{funcdesc} | |
| 49 | |
| 50 \begin{funcdesc}{decompress}{string} | |
| 51 Decompresses the data in \var{string}, returning a string containing | |
| 52 the uncompressed data. Raises the \code{zlib.error} exception if any | |
| 53 error occurs. | |
| 54 \end{funcdesc} | |
| 55 | |
| 56 \begin{funcdesc}{decompressobj}{\optional{wbits}} | |
| 57 Returns a compression object, to be used for decompressing data streams | |
|
5390
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
58 that won't fit into memory at once. The \var{wbits} parameter |
|
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
59 controls the size of the window buffer; usually this can be left |
|
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
60 alone. |
| 5387 | 61 \end{funcdesc} |
| 62 | |
| 63 Compression objects support the following methods: | |
| 64 | |
| 65 \begin{funcdesc}{compress}{string} | |
| 66 Compress \var{string}, returning a string containing compressed data | |
| 67 for at least part of the data in \var{string}. This data should be | |
| 68 concatenated to the output produced by any preceding calls to the | |
| 69 \code{compress()} method. Some input may be kept in internal buffers | |
| 70 for later processing. | |
| 71 \end{funcdesc} | |
| 72 | |
| 73 \begin{funcdesc}{flush}{} | |
| 74 All pending input is processed, and an string containing the remaining | |
| 75 compressed output is returned. After calling \code{flush()}, the | |
| 76 \code{compress()} method cannot be called again; the only realistic | |
| 77 action is to delete the object. | |
| 78 \end{funcdesc} | |
| 79 | |
| 80 Decompression objects support the following methods: | |
| 81 | |
| 82 \begin{funcdesc}{decompress}{string} | |
| 83 Decompress \var{string}, returning a string containing the | |
| 84 uncompressed data corresponding to at least part of the data in | |
| 85 \var{string}. This data should be concatenated to the output produced | |
| 86 by any preceding calls to the | |
|
5390
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
87 \code{decompress()} method. Some of the input data may be preserved |
|
b24e84a0f30b
Updated web ref and version#. Folded some long lines.
Guido van Rossum <guido@python.org>
parents:
5387
diff
changeset
|
88 in internal buffers for later processing. |
| 5387 | 89 \end{funcdesc} |
| 90 | |
| 91 \begin{funcdesc}{flush}{} | |
| 92 All pending input is processed, and a string containing the remaining | |
| 93 uncompressed output is returned. After calling \code{flush()}, the | |
| 94 \code{decompress()} method cannot be called again; the only realistic | |
| 95 action is to delete the object. | |
| 96 \end{funcdesc} | |
| 97 | |
| 98 | |
| 99 |
