diff options
author | Fred Drake <fdrake@acm.org> | 1998-03-10 05:41:08 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1998-03-10 05:41:08 (GMT) |
commit | b30d0164bfefb19eb09caeac18adc7a138cbbf8c (patch) | |
tree | ad2cf1e676002841134716d3079200e3834dfd38 /Doc/lib/libgzip.tex | |
parent | 4ef3329259a14ff57a937c7a24a2f13c1aea7e67 (diff) | |
download | cpython-b30d0164bfefb19eb09caeac18adc7a138cbbf8c.zip cpython-b30d0164bfefb19eb09caeac18adc7a138cbbf8c.tar.gz cpython-b30d0164bfefb19eb09caeac18adc7a138cbbf8c.tar.bz2 |
Logical markup.
Diffstat (limited to 'Doc/lib/libgzip.tex')
-rw-r--r-- | Doc/lib/libgzip.tex | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/Doc/lib/libgzip.tex b/Doc/lib/libgzip.tex index df99e5d..5dff3d1 100644 --- a/Doc/lib/libgzip.tex +++ b/Doc/lib/libgzip.tex @@ -1,41 +1,42 @@ -\section{Built-in Module \sectcode{gzip}} +\section{Standard Module \sectcode{gzip}} \label{module-gzip} -\bimodindex{gzip} +\stmodindex{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. - -\setindexsubitem{(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 +with that used by the GNU compression program \program{gzip}. +Accordingly, the \module{gzip} module provides the \class{GzipFile} +class to read and write \program{gzip}-format files, automatically +compressing or decompressing the data so it looks like an ordinary +file object. + +\class{GzipFile} objects simulate most of the methods of a file +object, though it's not possible to use the \method{seek()} and +\method{tell()} methods to access the file randomly. + + +\begin{funcdesc}{open}{fileobj\optional{, filename\optional{, mode\optional{, compresslevel}}}} + Returns a new \class{GzipFile} object on top of \var{fileobj}, which + can be a regular file, a \class{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 + The \program{gzip} file format includes the original filename of the + uncompressed file; when opening a \class{GzipFile} object for writing, it can be set by the \var{filename} argument. The default value is an empty string. \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. + integer from \code{1} to \code{9} controlling the level of + compression; \code{1} is fastest and produces the least compression, + and \code{9} is slowest and produces the most compression. The + default value of \var{compresslevel} is \code{9}. - Calling a \code{GzipFile} object's \code{close()} method does not + Calling a \class{GzipFile} object's \method{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. + \class{StringIO} object opened for writing as \var{fileobj}, and + retrieve the resulting memory buffer using the \class{StringIO} + object's \method{getvalue()} method. \end{funcdesc} \begin{seealso} |