Takes an iterator of bytes, returns an iterator of iterators of
uncompressed data. Expects input to conform to the output conventions of
PagingEncoder(), in particular that "pages" are separated with
an END_OF_INFO_CODE and padding up to the next byte boundary.
BUG: Dangling trailing page on decompression.
>>> import lzw
>>> pgdec = lzw.PagingDecoder(initial_code_size=257)
>>> pgdecoded = pgdec.decodepages(
... ''.join([ '\x80\x1c\xcc\'\x91\x01\xa0\xc2m6',
... '\x99NB\x03\xc9\xbe\x0b\x07\x84\xc2',
... '\xcd\xa68|"\x14 3\xc3\xa0\xd1c\x94',
... '\x02\x02\x80\x18M\xc6A\x01\xd0\xd0e',
... '\x10\x1c\x8c\xa73\xa0\x80\xc7\x02\x10',
... '\x19\xcd\xe2\x08\x14\x10\xe0l0\x9e`\x10',
... '\x10\x80\x18\xcc&\xe19\xd0@t7\x9dLf\x889',
... '\xa0\xd2s\x80@@' ])
... )
>>> [ b"".join(pg) for pg in pgdecoded ]
['say hammer yo hammer mc hammer go hammer', 'and the rest can go and play', "can't touch this", '']
|