Kyoto Cabinet

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Static Public Member Functions
kyotocabinet::LZMA Class Reference

LZMA compressor. More...

`#include <kccompress.h>`

List of all members.

## Public Types

enum | Mode { RAW, CRC, SHA }
| 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

LZMA compressor.

## Member Enumeration Documentation

enum kyotocabinet::LZMA::Mode

Compression modes.

Enumerator:

  RAW | without any checksum
  CRC | with CRC32 checksum
  SHA | with SHA256 checksum

## Member Function Documentation

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

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.
  mode | the 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::LZMA::decompress | ( | const void * | buf,
|  | size_t | size,
|  | size_t * | sp,
|  | Mode | mode = `RAW`
| ) |  | `[static]`

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.
  mode | the 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::LZMA::calculate_crc | ( | const void * | buf,
|  | size_t | size,
|  | uint32_t | seed = `0`
| ) |  | `[static]`

Calculate the CRC32 checksum of a serial data.

Parameters:

  buf | the input buffer.
  size | the size of the input buffer.
  seed | the cyclic seed value.

Returns:
  the CRC32 checksum.