eckit::BZip2Compressor class

Base classes

class Compressor

Constructors, destructors, conversion operators

BZip2Compressor()
~BZip2Compressor() override

Public functions

auto compress(const void* in, size_t len, eckit::Buffer& out) const -> size_t override
void uncompress(const void* in, size_t len, eckit::Buffer& out, size_t outlen) const override

Function documentation

size_t eckit::BZip2Compressor::compress(const void* in, size_t len, eckit::Buffer& out) const override

Parameters
in input buffer that holds the uncompressed bytesteam.
len input buffer size.
out output buffer to hold the compressed bytesteam. Buffer may be oversized, in which case resizing is implementation specific. Nevertheless, it is expected that implementations will take this as oppurtunity for optimising and avoid resizing.
Returns the size of the compressed bytestream inside out buffer, it is less or equal than out.size()

Compresses the bytestream within the in buffer

void eckit::BZip2Compressor::uncompress(const void* in, size_t len, eckit::Buffer& out, size_t outlen) const override

Parameters
in input buffer that holds the compressed bytesteam.
len input buffer size.
out output buffer to hold the uncompressed bytesteam.
outlen the expected size of the uncompressed bytestream. Buffer may be resized or if large enough implementations will try to used what is passed in. This could be a way to reuse the same memory buffer in a tight loop.

Uncompresses the bytestream within the in buffer Since some compression algorithms dont record uncompressed size in the bytestream, client code is required to record and handle the uncompressed size separately and pass it in via parameter outlen.