Compressor¶
-
class
asdf.extension.Compressor[source]¶ Bases:
abc.ABCAbstract base class for plugins that compress binary data.
Implementing classes must provide the
labelsproperty, and at least one of thecompress()anddecompress()methods. May also provide a constructor.Attributes Summary
Get the 4-byte label identifying this compression
Methods Summary
compress(data, **kwargs)Compress
data, yielding the results.decompress(data, out, **kwargs)Decompress
data, writing the result intoout.Attributes Documentation
-
label¶ Get the 4-byte label identifying this compression
- Returns
- labelbytes
The compression label
Methods Documentation
-
compress(data, **kwargs)[source]¶ Compress
data, yielding the results. The yield may be block-by-block, or all at once.- Parameters
- databytes-like
The data to compress. Must be contiguous and 1D, with the underlying
itemsizepreserved.- **kwargs
Keyword arguments to be passed to the underlying compression function
- Yields
- compressedbytes-like
A block of compressed data
-
decompress(data, out, **kwargs)[source]¶ Decompress
data, writing the result intoout.- Parameters
- databytes-like
The data to decompress. Must be contiguous and 1D.
- outread-write bytes-like
A contiguous, 1D output array, of equal or greater length than the decompressed data.
- **kwargs
Keyword arguments to be passed to the underlying decompression function
- Returns
- nbytesint
The number of bytes written to
out
-