SourcePro® C++ API Reference Guide

Product Documentation:
   SourcePro C++
Documentation Home
List of all members | Public Member Functions
RWSnappyCompressor Class Reference

Compressor adapter that compresses and decompresses data using the Google Snappy compression library. More...

#include <rw/tools/snappy/RWSnappyCompressor.h>

Public Member Functions

 RWSnappyCompressor ()
 
int compress (void *compressed, rwuint32 &compressed_length, const void *uncompressed, rwuint32 uncompressed_length)
 
int decompress (void *uncompressed, rwuint32 &uncompressed_length, const void *compressed, rwuint32 compressed_length)
 
int max_compressed_length (rwuint32 uncompressed_length, rwuint32 &compressed_length)
 
int uncompressed_length (const void *compressed, rwuint32 compressed_length, rwuint32 &uncompressed_length)
 

Detailed Description

Compressor adapter for compressing and decompressing data using the Google Snappy compression library.

Constructor & Destructor Documentation

RWSnappyCompressor::RWSnappyCompressor ( )

Initialize the compressor.

Member Function Documentation

int RWSnappyCompressor::compress ( void *  compressed,
rwuint32 &  compressed_length,
const void *  uncompressed,
rwuint32  uncompressed_length 
)

Compresses uncompressed_length bytes of data from uncompressed into compressed and stores the number of compressed bytes in compressed_length.

Returns -1 if compressed_length is not of sufficient size to store the compressed data.

int RWSnappyCompressor::decompress ( void *  uncompressed,
rwuint32 &  uncompressed_length,
const void *  compressed,
rwuint32  compressed_length 
)

Decompress compressed_length bytes of data from compressed and place it into uncompressed, and stores the number of uncompressed bytes to uncompressed_length on success.

Returns -1 if uncompressed_length is not of sufficient size to store the decompressed data or if compressed refers to data that could not be decompressed.

int RWSnappyCompressor::max_compressed_length ( rwuint32  uncompressed_length,
rwuint32 &  compressed_length 
)

Calculates the maximum number of bytes needed to store a compressed byte array given uncompressed_length bytes of uncompressed data. Stores the result in compressed_length.

Returns 0 on success.

int RWSnappyCompressor::uncompressed_length ( const void *  compressed,
rwuint32  compressed_length,
rwuint32 &  uncompressed_length 
)

Calculates the number of bytes needed to store an uncompressed byte array given compressed_length bytes of compressed data stored in compressed. Stores the result in uncompressed_length.

Returns -1 to indicate that the compressed data stream was invalid.

Copyright © 2016 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.