Home | Trees | Indices | Help |
---|
|
object --+ | ByteEncoder
Takes a stream of uncompressed bytes and produces a stream of compressed bytes, usable by ByteDecoder. Combines an Encoder with a BitPacker.
>>> import lzw >>> >>> enc = lzw.ByteEncoder(12) >>> bigstr = b"gabba gabba yo gabba gabba gabba yo gabba gabba gabba yo gabba gabba gabba yo" >>> encoding = enc.encodetobytes(bigstr) >>> encoded = b"".join( b for b in encoding ) >>> encoded '3\x98LF#\x08\x82\x05\x04\x83\x1eM\xf0x\x1c\x16\x1b\t\x88C\xe1q(4"\x1f\x17\x85C#1X\xec.\x00' >>> >>> dec = lzw.ByteDecoder() >>> decoding = dec.decodefrombytes(encoded) >>> decoded = b"".join(decoding) >>> decoded == bigstr True
Instance Methods | |||
|
|||
|
|||
Inherited from |
Properties | |
Inherited from |
Method Details |
max_width is the maximum width in bits we want to see in the output stream of codepoints.
|
Returns an iterator of bytes, adjusting our packed width between minwidth and maxwidth when it detects an overflow is about to occur. Dual of ByteDecoder.decodefrombytes. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Apr 20 15:25:48 2010 | http://epydoc.sourceforge.net |