Given an iterator of bytes, returns an iterator of integer code
points. Auto-magically adjusts point width when it sees an
almost-overflow in the input stream, or an LZW CLEAR_CODE or
END_OF_INFO_CODE
Trailing bits at the end of the given iterator, after the last
codepoint, will be dropped on the floor.
At the end of the iteration, or when an END_OF_INFO_CODE seen the
unpacker will ignore the bits after the code until it reaches the next
aligned byte. END_OF_INFO_CODE will *not* stop the generator, just reset
the alignment and the width
>>> import lzw
>>> unpk = lzw.BitUnpacker(initial_code_size=258)
>>> [ i for i in unpk.unpack([ chr(0), chr(0xC0), chr(0x40) ]) ]
[1, 257]
|