diff options
author | Guido van Rossum <guido@python.org> | 1997-07-17 16:26:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-07-17 16:26:11 (GMT) |
commit | 41884a9b1c8d147d93cea756ee165dc8f6e15b46 (patch) | |
tree | 5307a372fe0e20facc8f0d32e82603d49d903f90 | |
parent | 0245569fd1ebb24c971be0975c4bd2f6cbc5e9a0 (diff) | |
download | cpython-41884a9b1c8d147d93cea756ee165dc8f6e15b46.zip cpython-41884a9b1c8d147d93cea756ee165dc8f6e15b46.tar.gz cpython-41884a9b1c8d147d93cea756ee165dc8f6e15b46.tar.bz2 |
New from AMK
-rw-r--r-- | Doc/lib/libgzip.tex | 44 | ||||
-rw-r--r-- | Doc/libgzip.tex | 44 |
2 files changed, 88 insertions, 0 deletions
diff --git a/Doc/lib/libgzip.tex b/Doc/lib/libgzip.tex new file mode 100644 index 0000000..d444ebf --- /dev/null +++ b/Doc/lib/libgzip.tex @@ -0,0 +1,44 @@ +\section{Built-in Module \sectcode{gzip}} +\label{module-gzip} +\bimodindex{gzip} + +The data compression provided by the \code{zlib} module is compatible +with that used by the GNU compression program \file{gzip}. +Accordingly, the \code{gzip} module provides the \code{GzipFile} class +to read and write \file{gzip}-format files, automatically compressing +or decompressing the data so it looks like an ordinary file object. + +\code{GzipFile} objects simulate most of the methods of a file +object, though it's not possible to use the \code{seek()} and +\code{tell()} methods to access the file randomly. + +\renewcommand{\indexsubitem}{(in module gzip)} +\begin{funcdesc}{open}{fileobj\optional{\, filename\optional{\, mode\, compresslevel}}} + Returns a new \code{GzipFile} object on top of \var{fileobj}, which + can be a regular file, a \code{StringIO} object, or any object which + simulates a file. + + The \file{gzip} file format includes the original filename of the + uncompressed file; when opening a \code{GzipFile} object for + writing, it can be set by the \var{filename} argument. The default + value is \code{"GzippedFile"}. + + \var{mode} can be either \code{'r'} or \code{'w'} depending on + whether the file will be read or written. \var{compresslevel} is an + integer from 1 to 9 controlling the level of compression; 1 is + fastest and produces the least compression, and 9 is slowest and + produces the most compression. The default value of + \var{compresslevel} is 9. + + Calling a \code{GzipFile} object's \code{close()} method does not + close \var{fileobj}, since you might wish to append more material + after the compressed data. This also allows you to pass a + \code{StringIO} object opened for writing as \var{fileobj}, and + retrieve the resulting memory buffer using the \code{StringIO} + object's \code{getvalue()} method. +\end{funcdesc} + +\begin{seealso} +\seemodule{zlib}{the basic data compression module} +\end{seealso} + diff --git a/Doc/libgzip.tex b/Doc/libgzip.tex new file mode 100644 index 0000000..d444ebf --- /dev/null +++ b/Doc/libgzip.tex @@ -0,0 +1,44 @@ +\section{Built-in Module \sectcode{gzip}} +\label{module-gzip} +\bimodindex{gzip} + +The data compression provided by the \code{zlib} module is compatible +with that used by the GNU compression program \file{gzip}. +Accordingly, the \code{gzip} module provides the \code{GzipFile} class +to read and write \file{gzip}-format files, automatically compressing +or decompressing the data so it looks like an ordinary file object. + +\code{GzipFile} objects simulate most of the methods of a file +object, though it's not possible to use the \code{seek()} and +\code{tell()} methods to access the file randomly. + +\renewcommand{\indexsubitem}{(in module gzip)} +\begin{funcdesc}{open}{fileobj\optional{\, filename\optional{\, mode\, compresslevel}}} + Returns a new \code{GzipFile} object on top of \var{fileobj}, which + can be a regular file, a \code{StringIO} object, or any object which + simulates a file. + + The \file{gzip} file format includes the original filename of the + uncompressed file; when opening a \code{GzipFile} object for + writing, it can be set by the \var{filename} argument. The default + value is \code{"GzippedFile"}. + + \var{mode} can be either \code{'r'} or \code{'w'} depending on + whether the file will be read or written. \var{compresslevel} is an + integer from 1 to 9 controlling the level of compression; 1 is + fastest and produces the least compression, and 9 is slowest and + produces the most compression. The default value of + \var{compresslevel} is 9. + + Calling a \code{GzipFile} object's \code{close()} method does not + close \var{fileobj}, since you might wish to append more material + after the compressed data. This also allows you to pass a + \code{StringIO} object opened for writing as \var{fileobj}, and + retrieve the resulting memory buffer using the \code{StringIO} + object's \code{getvalue()} method. +\end{funcdesc} + +\begin{seealso} +\seemodule{zlib}{the basic data compression module} +\end{seealso} + |