summaryrefslogtreecommitdiffstats
path: root/Doc/library/zlib.rst
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-06-21 00:13:12 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-06-21 00:13:12 (GMT)
commitfd8a838d582e3495004036bc82e3e6fee91fa0ba (patch)
tree1857e51ac2ee013cdd896b712014b158cd47575b /Doc/library/zlib.rst
parent50b0a365ba8ea87e0a7155f7fd92de0c7dc2f941 (diff)
downloadcpython-fd8a838d582e3495004036bc82e3e6fee91fa0ba.zip
cpython-fd8a838d582e3495004036bc82e3e6fee91fa0ba.tar.gz
cpython-fd8a838d582e3495004036bc82e3e6fee91fa0ba.tar.bz2
Issue #14684: Add support for predefined compression dictionaries to the zlib module.
Original patch by Sam Rushing.
Diffstat (limited to 'Doc/library/zlib.rst')
-rw-r--r--Doc/library/zlib.rst31
1 files changed, 24 insertions, 7 deletions
diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst
index 1e9a2bc..705f734 100644
--- a/Doc/library/zlib.rst
+++ b/Doc/library/zlib.rst
@@ -58,12 +58,19 @@ The available exception and functions in this module are:
exception if any error occurs.
-.. function:: compressobj([level])
+.. function:: compressobj([level[, method[, wbits[, memlevel[, strategy[, zdict]]]]]])
Returns a compression object, to be used for compressing data streams that won't
- fit into memory at once. *level* is an integer from ``1`` to ``9`` controlling
- the level of compression; ``1`` is fastest and produces the least compression,
- ``9`` is slowest and produces the most. The default value is ``6``.
+ fit into memory at once.
+
+ *level* is an integer from ``1`` to ``9`` controlling the level of
+ compression; ``1`` is fastest and produces the least compression, ``9`` is
+ slowest and produces the most. The default value is ``6``.
+
+ *zdict* is a predefined compression dictionary. This is a sequence of bytes
+ (such as a :class:`bytes` object) containing subsequences that are expected
+ to occur frequently in the data that is to be compressed. Those subsequences
+ that are expected to be most common should come at the end of the dictionary.
.. function:: crc32(data[, value])
@@ -114,11 +121,21 @@ The available exception and functions in this module are:
to :c:func:`malloc`. The default size is 16384.
-.. function:: decompressobj([wbits])
+.. function:: decompressobj([wbits[, zdict]])
Returns a decompression object, to be used for decompressing data streams that
- won't fit into memory at once. The *wbits* parameter controls the size of the
- window buffer.
+ won't fit into memory at once.
+
+ The *wbits* parameter controls the size of the window buffer.
+
+ The *zdict* parameter specifies a predefined compression dictionary. If
+ provided, this must be the same dictionary as was used by the compressor that
+ produced the data that is to be decompressed.
+
+.. note::
+ If *zdict* is a mutable object (such as a :class:`bytearray`), you must not
+ modify its contents between the call to :func:`decompressobj` and the first
+ call to the decompressor's ``decompress()`` method.
Compression objects support the following methods: