# kyotocabinet::Compressor Class Reference

Interfrace of data compression and decompression. More...

`#include <kccompress.h>`

List of all members.

## Public Member Functions

virtual | ~Compressor ()
| Destructor.
virtual char * | compress (const void *buf, size_t size, size_t *sp)=0
| Compress a serial data.
virtual char * | decompress (const void *buf, size_t size, size_t *sp)=0
| Decompress a serial data.

## Detailed Description

Interfrace of data compression and decompression.

## Constructor & Destructor Documentation

virtual kyotocabinet::Compressor::~Compressor | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual char* kyotocabinet::Compressor::compress | ( | const void * | buf,
|  | size_t | size,
|  | size_t * | sp
| ) |  | `[pure virtual]`

Compress 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 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.

virtual char* kyotocabinet::Compressor::decompress | ( | const void * | buf,
|  | size_t | size,
|  | size_t * | sp
| ) |  | `[pure virtual]`

Decompress 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 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.