taurus taurus

Previous topic

CodecFactory

Next topic

ColorPalette

This Page

CodecPipeline

Inheritance diagram of CodecPipeline

class CodecPipeline(format)

Bases: taurus.core.util.codecs.Codec, list

The codec class used when encoding/decoding data with multiple encoders

Example usage:

>>> from taurus.core.util import CodecPipeline

>>> data = range(100000)
>>> codec = CodecPipeline('bz2_json')
>>> format, encoded_data = codec.encode(("", data))

# decode it 
format, decoded_data = codec.decode((format, encoded_data))
print decoded_data
decode(data, *args, **kwargs)

decodes the given data.

Parameters:data (:class:~`sequence[str, obj]`) – a sequence of two elements where the first item is the encoding format of the second item object
Return type::class:~`sequence[str, obj]`
Returns:a sequence of two elements where the first item is the encoding format of the second item object
encode(data, *args, **kwargs)

encodes the given data.

Parameters:data (:class:~`sequence[str, obj]`) – a sequence of two elements where the first item is the encoding format of the second item object
Return type::class:~`sequence[str, obj]`
Returns:a sequence of two elements where the first item is the encoding format of the second item object