Debian Codegraph @

src/calibre/ebooks/lit/lzx.py

raw
1 # License: GPLv3 Copyright: 2008, Marshall T. Vandegrift <[email protected]>
2
3 """
4 LZX compression/decompression wrapper.
5 """
6
7 from calibre_extensions import lzx as _lzx
8
9 __all__ = ['Compressor', 'Decompressor', 'LZXError']
10
11 LZXError = _lzx.LZXError
12 Compressor = _lzx.Compressor
13
14
15 class Decompressor:
16 def __init__(self, wbits):
17 self.wbits = wbits
18 self.blocksize = 1 << wbits
19 _lzx.init(wbits)
20
21 def decompress(self, data, outlen):
22 return _lzx.decompress(data, outlen)
23
24 def reset(self):
25 return _lzx.reset()