Compressor implemeted with ZLib.
More...
#include <tkrzw_compress.h>
Compressor implemeted with ZLib.
◆ MetadataMode
Enumeration for metadata modes.
Enumerator |
---|
METADATA_NONE | Without any checksum.
|
METADATA_ADLER32 | With Adler-32 checksum, compatible with deflate.
|
METADATA_CRC32 | With CRC-32 checksum, compatible with gzip.
|
◆ ZLibCompressor()
Constructor.
- Parameters
-
level | The compression level between 0 and 9. Higher means slower but better compression. 0 means no compression. |
metadata_mode | The mode for the metadata added to the result. |
◆ ~ZLibCompressor()
virtual tkrzw::ZLibCompressor::~ZLibCompressor |
( |
| ) |
|
|
virtual |
◆ IsSupported()
bool tkrzw::ZLibCompressor::IsSupported |
( |
| ) |
const |
|
overridevirtual |
Checks whether the implementation is actually supported.
- Returns
- True if the implementation is actually supported.
Implements tkrzw::Compressor.
◆ Compress()
char* tkrzw::ZLibCompressor::Compress |
( |
const void * |
buf, |
|
|
size_t |
size, |
|
|
size_t * |
sp |
|
) |
| const |
|
overridevirtual |
Compresses a serial data.
- Parameters
-
buf | the input buffer. |
size | the size of the input buffer. |
sp | the pointer to the variable into which the size of the region of the return value is assigned. |
- Returns
- The pointer to the result data, or nullptr on failure.
Because the region of the return value is allocated with the xmalloc function, it should be released with the xfree function.
Implements tkrzw::Compressor.
◆ Decompress()
char* tkrzw::ZLibCompressor::Decompress |
( |
const void * |
buf, |
|
|
size_t |
size, |
|
|
size_t * |
sp |
|
) |
| const |
|
overridevirtual |
Decompresses a serial data.
- Parameters
-
buf | the input buffer. |
size | the size of the input buffer. |
sp | the pointer to the variable into which the size of the region of the return value is assigned. |
- Returns
- The pointer to the result data, or nullptr on failure.
Because the region of the return value is allocated with the xmalloc function, it should be released with the xfree function.
Implements tkrzw::Compressor.
◆ MakeCompressor()
std::unique_ptr<Compressor> tkrzw::ZLibCompressor::MakeCompressor |
( |
| ) |
const |
|
overridevirtual |