class documentation

Baseclass for compression strategies.

A compression strategy is responsible for deciding how blobs should# be bundled into clusters. For this, they take pyzim.item.Item instances (which also grants them additional informations like mimetype), decide which cluster they should belong to, instantiate entries and set the proper cluster and blob numbers.

BaseCompressionStrategy instances are supposed to be used in a recursive hierarchy. For example, one compression strategy could take an item, analyzes it for its mimetype, then entries of each mimetype grouped together to another compression strategy (instantiated once for each mimetype) that puts all items below a specific size into an uncompressed cluster.

Method __init__ The default constructor.
Method add_item Handle the addition of an item (e.g. create entries, ...).
Method flush Flush all current items.
Method has_items True if this compression strategy still has items to be written.
Instance Variable zim zim archive this compression strategy compresses for
def __init__(self, zim):

The default constructor.

Parameters
zim:pyzim.archive.Zimzim archive this compression strategy compresses for
def add_item(self, item):

Handle the addition of an item (e.g. create entries, ...).

Parameters
item:pyzim.item.Itemitem to add
def flush(self):

Flush all current items.

This should create and flush all remaining clusters and entries.

def has_items(self):

True if this compression strategy still has items to be written.

Returns
boolwhether there are some items that still need to be written

zim archive this compression strategy compresses for