lzw.PagingEncoder

Package lzw :: Class PagingEncoder |
[frames] | no frames]

# Class PagingEncoder

source code

    object --+
             |
            PagingEncoder

UNTESTED. Handles encoding of multiple chunks or streams of encodable data, separated with control codes. Dual of PagingDecoder.

Instance Methods
__init__(self, initial_code_size, max_code_size) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
encodepages(self, pages) Given an iterator of iterators of bytes, produces a single iterator containing a delimited sequence of independantly compressed LZW sequences, all beginning on a byte-aligned spot, all beginning with a CLEAR code and all terminated with an END_OF_INFORMATION code (and zero to seven trailing junk bits.) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, initial_code_size, max_code_size) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### encodepages(self, pages) | source code
Given an iterator of iterators of bytes, produces a single iterator containing a delimited sequence of independantly compressed LZW sequences, all beginning on a byte-aligned spot, all beginning with a CLEAR code and all terminated with an END_OF_INFORMATION code (and zero to seven trailing junk bits.) The dual of PagingDecoder.decodepages
    >>> import lzw
    >>> enc = lzw.PagingEncoder(257, 2**12)
    >>> coded = enc.encodepages([ "say hammer yo hammer mc hammer go hammer",
    ...                           "and the rest can go and play",
    ...                           "can't touch this" ])
    ...
    >>> b"".join(coded)
    '\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@@'