Kyoto Cabinet
Public Types | Static Public Member Functions
kyotocabinet::ZLIB Class Reference

ZLIB compressor. More...

#include <kccompress.h>

List of all members.

Public Types

enum  Mode { RAW, DEFLATE, GZIP }
 Compression modes. More...

Static Public Member Functions

static char * compress (const void *buf, size_t size, size_t *sp, Mode mode=RAW)
 Compress a serial data.
static char * decompress (const void *buf, size_t size, size_t *sp, Mode mode=RAW)
 Decompress a serial data.
static uint32_t calculate_crc (const void *buf, size_t size, uint32_t seed=0)
 Calculate the CRC32 checksum of a serial data.

Detailed Description

ZLIB compressor.


Member Enumeration Documentation

Compression modes.

Enumerator:
RAW 

without any checksum

DEFLATE 

with Adler32 checksum

GZIP 

with CRC32 checksum and various meta data


Member Function Documentation

static char* kyotocabinet::ZLIB::compress ( const void *  buf,
size_t  size,
size_t *  sp,
Mode  mode = RAW 
) [static]

Compress a serial data.

Parameters:
bufthe input buffer.
sizethe size of the input buffer.
spthe pointer to the variable into which the size of the region of the return value is assigned.
modethe compression mode.
Returns:
the pointer to the result data, or NULL on failure.
Note:
Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.
static char* kyotocabinet::ZLIB::decompress ( const void *  buf,
size_t  size,
size_t *  sp,
Mode  mode = RAW 
) [static]

Decompress a serial data.

Parameters:
bufthe input buffer.
sizethe size of the input buffer.
spthe pointer to the variable into which the size of the region of the return value is assigned.
modethe compression mode.
Returns:
the pointer to the result data, or NULL on failure.
Note:
Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a C-style string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.
static uint32_t kyotocabinet::ZLIB::calculate_crc ( const void *  buf,
size_t  size,
uint32_t  seed = 0 
) [static]

Calculate the CRC32 checksum of a serial data.

Parameters:
bufthe input buffer.
sizethe size of the input buffer.
seedthe cyclic seed value.
Returns:
the CRC32 checksum.