PocketLzma  1.0.0
A cross-platform singleheader LZMA compression/decompression library for C++11
Public Member Functions | List of all members
plz::PocketLzma Class Reference

#include <pocketlzma_class.hpp>

Public Member Functions

 PocketLzma ()=default
 
 PocketLzma (Preset preset)
 
 PocketLzma (const Settings &settings)
 
void setSettings (const Settings &settings)
 
void usePreset (Preset preset)
 
StatusCode compress (const std::vector< uint8_t > &input, std::vector< uint8_t > &output)
 
StatusCode compress (const uint8_t *input, const size_t inputSize, std::vector< uint8_t > &output)
 
StatusCode decompress (const std::vector< uint8_t > &input, std::vector< uint8_t > &output)
 
StatusCode decompress (const uint8_t *input, const size_t inputSize, std::vector< uint8_t > &output)
 
StatusCode decompressBuffered (const std::vector< uint8_t > &input, std::vector< uint8_t > &output, uint32_t bufferSize=PLZ_BUFFER_SIZE)
 
StatusCode decompressBuffered (const uint8_t *input, const size_t inputSize, std::vector< uint8_t > &output, uint32_t bufferSize=PLZ_BUFFER_SIZE)
 

Constructor & Destructor Documentation

◆ PocketLzma() [1/3]

plz::PocketLzma::PocketLzma ( )
default

◆ PocketLzma() [2/3]

plz::PocketLzma::PocketLzma ( Preset  preset)
inlineexplicit

◆ PocketLzma() [3/3]

plz::PocketLzma::PocketLzma ( const Settings settings)
inlineexplicit

Member Function Documentation

◆ compress() [1/2]

StatusCode plz::PocketLzma::compress ( const std::vector< uint8_t > &  input,
std::vector< uint8_t > &  output 
)
inline

◆ compress() [2/2]

StatusCode plz::PocketLzma::compress ( const uint8_t *  input,
const size_t  inputSize,
std::vector< uint8_t > &  output 
)
inline

◆ decompress() [1/2]

StatusCode plz::PocketLzma::decompress ( const std::vector< uint8_t > &  input,
std::vector< uint8_t > &  output 
)
inline

Decompresses LZMA data.

Will choose the best solution based on whether lzma file size in header is known or not. In cases where the file size is unknown, decompressBuffered() will be called

Parameters
inputThe input compressed data
outputThe decompressed data
Returns
Status for the decompression process

◆ decompress() [2/2]

StatusCode plz::PocketLzma::decompress ( const uint8_t *  input,
const size_t  inputSize,
std::vector< uint8_t > &  output 
)
inline

Decompresses LZMA data.

Will choose the best solution based on whether lzma file size in header is known or not. In cases where the file size is unknown, decompressBuffered() will be called

Parameters
inputThe input compressed data
outputThe decompressed data
Returns
Status for the decompression process

◆ decompressBuffered() [1/2]

StatusCode plz::PocketLzma::decompressBuffered ( const std::vector< uint8_t > &  input,
std::vector< uint8_t > &  output,
uint32_t  bufferSize = PLZ_BUFFER_SIZE 
)
inline

Prefer using decompress().

Only use this if you for some reason required the decompression to be buffered or somehow think you can benefit from reading the data buffered. decompressBuffered() will probably always be slower than the regular decompress() when the LZMA header contains a known file size. decompress() will automatically call decompressBuffered() when file size in LZMA header is unknown.

When file size is unknown in the LZMA header, data is always read using the buffered system. This will be slightly slower than normal decompression, but does not require the file result to be known

Parameters
inputThe input compressed data
outputThe decompressed data
bufferSizeThe buffer size. Default buffer size for pocketlzma is 65536 bytes.
Returns
Status for the decompression process

◆ decompressBuffered() [2/2]

StatusCode plz::PocketLzma::decompressBuffered ( const uint8_t *  input,
const size_t  inputSize,
std::vector< uint8_t > &  output,
uint32_t  bufferSize = PLZ_BUFFER_SIZE 
)
inline

Prefer using decompress().

Only use this if you for some reason required the decompression to be buffered or somehow think you can benefit from reading the data buffered. decompressBuffered() will probably always be slower than the regular decompress() when the LZMA header contains a known file size. decompress() will automatically call decompressBuffered() when file size in LZMA header is unknown.

When file size is unknown in the LZMA header, data is always read using the buffered system. This will be slightly slower than normal decompression, but does not require the file result to be known

Parameters
inputThe input data
outputThe decompressed data
bufferSizeThe buffer size. Default buffer size for pocketlzma is 65536 bytes.
Returns
Status for the decompression process

◆ setSettings()

void plz::PocketLzma::setSettings ( const Settings settings)
inline

This is optional. PocketLzma uses default values if not set by the user.

If you are a casual user: usePreset() is recommended.

Parameters
settingsnew settings

◆ usePreset()

void plz::PocketLzma::usePreset ( Preset  preset)
inline

Set a preset to control compression speed vs ratio.

Recommended: For fast compression: Preset::Fast For balanced compression: Preset::Default For good compression: Preset::GoodCompression

Note: Not used when decompressing.


The documentation for this class was generated from the following file: