SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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::RWSnappyCompressor ( )

Initialize the compressor.

Member Function Documentation

◆ compress()

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.

◆ decompress()

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.

◆ max_compressed_length()

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.

◆ uncompressed_length()

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 © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.