Sequential compression and decompression is done using the classes
BZ2Compressor and BZ2Decompressor.
class BZ2Compressor( |
[compresslevel]) |
-
Create a new compressor object. This object may be used to compress
data sequentially. If you want to compress data in one shot, use the
compress() function instead. The compresslevel parameter,
if given, must be a number between
1
and 9
; the default
is 9
.
-
Provide more data to the compressor object. It will return chunks of compressed
data whenever possible. When you've finished providing data to compress, call
the flush() method to finish the compression process, and return what
is left in internal buffers.
-
Finish the compression process and return what is left in internal buffers. You
must not use the compressor object after calling this method.
-
Create a new decompressor object. This object may be used to decompress
data sequentially. If you want to decompress data in one shot, use the
decompress() function instead.
-
Provide more data to the decompressor object. It will return chunks of
decompressed data whenever possible. If you try to decompress data after the
end of stream is found, EOFError will be raised. If any data was
found after the end of stream, it'll be ignored and saved in
unused_data attribute.
Release 2.3.4, documentation updated on May 20, 2004.
See About this document... for information on suggesting changes.