Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | Static Public Member Functions | List of all members
Botan::Compression_Algorithm Class Referenceabstract

`#include <compression.h>`

Inheritance diagram for Botan::Compression_Algorithm:

## Public Member Functions
virtual void | clear ()=0
virtual void | finish (secure_vector< uint8_t > &final_block, size_t offset=0)=0
virtual std::string | name () const =0
virtual void | start (size_t comp_level=0)=0
virtual void | update (secure_vector< uint8_t > &buf, size_t offset=0, bool flush=false)=0
virtual | ~Compression_Algorithm ()

## Static Public Member Functions
static std::unique_ptr< Compression_Algorithm > | create (const std::string &algo_spec)
static std::unique_ptr< Compression_Algorithm > | create_or_throw (const std::string &algo_spec)

## Detailed Description

Interface for a compression algorithm.

Definition at line 20 of file compression.h.

## Constructor & Destructor Documentation

## ◆ ~Compression_Algorithm()

virtual Botan::Compression_Algorithm::~Compression_Algorithm | ( |  | ) |
| inline virtual

Definition at line 75 of file compression.h.

75{}

## Member Function Documentation

## ◆ clear()

virtual void Botan::Compression_Algorithm::clear | ( |  | ) |
| pure virtual

Reset the state and abort the current message; start can be called again to process a new message.

Implemented in Botan::Stream_Compression.

## ◆ create()

std::unique_ptr< Compression_Algorithm > Botan::Compression_Algorithm::create | ( | const std::string & | algo_spec | ) |
| static

Create an instance based on a name, or return null if the algo combination cannot be found.

Definition at line 54 of file compression.cpp.

55 {
56 std::unique_ptr<Compression_Algorithm> compressor(make_compressor(algo));
57 return compressor;
58 }
Botan::make_compressor
Compression_Algorithm * make_compressor(const std::string &name)
Definition: compression.cpp:27

References Botan::make_compressor().

Referenced by create_or_throw().

## ◆ create_or_throw()

std::unique_ptr< Compression_Algorithm > Botan::Compression_Algorithm::create_or_throw | ( | const std::string & | algo_spec | ) |
| static

Create an instance based on a name

Parameters

  algo_spec | algorithm name Throws Lookup_Error if not found.

Definition at line 62 of file compression.cpp.

63 {
64 if(auto compressor = Compression_Algorithm::create(algo))
65 {
66 return compressor;
67 }
68 throw Lookup_Error("Compression", algo, "");
69 }
Botan::Compression_Algorithm::create
static std::unique_ptr< Compression_Algorithm > create(const std::string &algo_spec)
Definition: compression.cpp:54

References create().

## ◆ finish()

virtual void Botan::Compression_Algorithm::finish | ( | secure_vector< uint8_t > & | final_block,
|  | size_t | offset = `0`
| ) |  |
| pure virtual

Finish compressing

Parameters

  final_block | in/out parameter
  offset | an offset into final_block to begin processing

Implemented in Botan::Stream_Compression.

## ◆ name()

virtual std::string Botan::Compression_Algorithm::name | ( |  | ) | const
| pure virtual

Returns
  name of the compression algorithm

Implemented in Botan::Bzip2_Compression, Botan::LZMA_Compression, Botan::Zlib_Compression, Botan::Deflate_Compression, and Botan::Gzip_Compression.

## ◆ start()

virtual void Botan::Compression_Algorithm::start | ( | size_t | comp_level = `0` | ) |
| pure virtual

Begin compressing. Most compression algorithms offer a tunable time/compression tradeoff parameter generally represented by an integer in the range of 1 to 9.

If 0 or a value out of range is provided, a compression algorithm specific default is used.

## ◆ update()

virtual void Botan::Compression_Algorithm::update | ( | secure_vector< uint8_t > & | buf,
|  | size_t | offset = `0`,
|  | bool | flush = `false`
| ) |  |
| pure virtual

Process some data.

Parameters

  buf | in/out parameter which will possibly be resized or swapped
  offset | an offset into blocks to begin processing
  flush | if true the compressor will be told to flush state

Implemented in Botan::Stream_Compression.

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

- src/lib/compression/compression.h
- src/lib/compression/compression.cpp