Utils::ByteBuffer Decompressor::decompress(char* src, unsigned long src_len) { Utils::ByteBuffer dst; unsigned dst_len = 128 * 1024; dst.setSize(dst_len); decompress(dst.getBufferSigned(), dst.getSize(), src, src_len); dst.setSize(decompressed()); return dst; }
void Compressor::compress(Utils::ByteBuffer& dst, char* src, unsigned long src_len) { unsigned bfr_size = compressBound(src_len); bool done = false; while (!done) { dst.setSize(bfr_size); try { compress(dst.getBufferSigned(), dst.getSize(), src, src_len); done = true; } catch (BufferTooShort& e) { (void)e; bfr_size <<= 1; } } dst.setSize(m_compressed); }
void Decompressor::decompress(Utils::ByteBuffer& dst, Utils::ByteBuffer& src) { decompress(dst.getBufferSigned(), dst.getSize(), src.getBufferSigned(), src.getSize()); dst.setSize(decompressed()); }
void Compressor::compress(Utils::ByteBuffer& dst, Utils::ByteBuffer& src) { return compress(dst, src.getBufferSigned(), src.getSize()); }