class documentation

Base class for compression interfaces.

A CompressionInterface provides a set of methods to compress and decompress data in a standardized format.

This interface is based on compressor-like and decompressor-like objects. A compressor-like object (e.g. lzma.LZMACompressor) will be used to compress data while a decompressor-like object (e.g. lzma.LZMADecompressor) will be used to decompress the data without storing it in memory all at once.

The get_(de)compressor() methods take an 'options' argument. This argument is a dictionary providing further option settings for the (de-)compressor. These options are mostly compression-type dependent and are not standardized. It is recommended to name the options "type.option", e.g. "lzma.check". Unknown options should be ignored.

Additionally, the following options are recommended to be implemented:

  • general.target: target to optimize compression for (e.g. performance, compression).
  • general.allow_threads: only use threads for (de)compression if this is nonzero
Static Method get_compressor Return a compressor object which can be used to compress data.
Static Method get_decompressor Return a decompressor object which can be used to decompress data.
Class Variable compression_type compression type used by this interface
def get_compressor(options={}):

Return a compressor object which can be used to compress data.

Parameters
options:dictadditional options for the compressor.
Returns
a compressor-like object. See pyzim.compression.BaseCompressionInterface for more info.a compressor object
def get_decompressor(options={}):

Return a decompressor object which can be used to decompress data.

Parameters
options:dictadditional options for the decompressor.
Returns
a decompressor-like object. See pyzim.compression.BaseCompressionInterface for more info.a decompressor object

compression type used by this interface