Module gzip
[hide private]
[frames] | no frames]

Module gzip

Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression, but random access is not allowed.

Classes [hide private]
GzipFile
The GzipFile class simulates most of the methods of a file object with the exception of the readinto() and truncate() methods.
Functions [hide private]
 
U32(i)
Return i as an unsigned integer, assuming it fits in 32 bits.
 
LOWU32(i)
Return the low-order 32 bits of an int, as a non-negative int.
 
write32(output, value)
 
write32u(output, value)
 
read32(input)
 
open(filename, mode='rb', compresslevel=9)
Shorthand for GzipFile(filename, mode, compresslevel).
 
_test()
Variables [hide private]
  FCOMMENT = 16
  FEXTRA = 4
  FHCRC = 2
  FNAME = 8
  FTEXT = 1
  READ = 1
  WRITE = 2

Imports: struct, sys, time, zlib, __builtin__


Function Details [hide private]

U32(i)

 

Return i as an unsigned integer, assuming it fits in 32 bits.

If it's >= 2GB when viewed as a 32-bit unsigned int, return a long.

open(filename, mode='rb', compresslevel=9)

 

Shorthand for GzipFile(filename, mode, compresslevel).

The filename argument is required; mode defaults to 'rb' and compresslevel defaults to 9.