Skip to content

File include/brisk/core/Compression.hpp


CompressionLevel enum

enum class CompressionLevel

Represents different levels of compression. Each level corresponds to a trade-off between speed and compression ratio.

Lowest enumerator (CompressionLevel::Lowest)

Lowest compression, fastest speed.

Low enumerator (CompressionLevel::Low)

Low compression.

Normal enumerator (CompressionLevel::Normal)

Standard compression level.

High enumerator (CompressionLevel::High)

High compression, slower speed.

Highest enumerator (CompressionLevel::Highest)

Highest compression, slowest speed.


CompressionMethod enum

enum class CompressionMethod

Represents different compression methods available.

None enumerator (CompressionMethod::None)

No compression.

GZip enumerator (CompressionMethod::GZip)

GZip compression.

ZLib enumerator (CompressionMethod::ZLib)

ZLib compression.

LZ4 enumerator (CompressionMethod::LZ4)

LZ4 compression.

Brotli enumerator (CompressionMethod::Brotli)

Brotli compression (enabled by BRISK_BROTLI cmake option).


defaultNames variable

template <>
inline constexpr std::initializer_list<
    NameValuePair<CompressionMethod>>
    defaultNames<CompressionMethod>

Default mapping between compression method names and their enum values.


gzipDecoder function

RC<Stream> gzipDecoder(RC<Stream> reader)

Creates a Stream that reads GZip-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.


gzipEncoder function

RC<Stream> gzipEncoder(RC<Stream> writer,
                       CompressionLevel level)

Creates a Stream that writes GZip-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.


zlibDecoder function

RC<Stream> zlibDecoder(RC<Stream> reader)

Creates a Stream that reads ZLib-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.


zlibEncoder function

RC<Stream> zlibEncoder(RC<Stream> writer,
                       CompressionLevel level)

Creates a Stream that writes ZLib-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.


lz4Decoder function

RC<Stream> lz4Decoder(RC<Stream> reader)

Creates a Stream that reads LZ4-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.


lz4Encoder function

RC<Stream> lz4Encoder(RC<Stream> writer,
                      CompressionLevel level)

Creates a Stream that writes LZ4-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.


brotliDecoder function

RC<Stream> brotliDecoder(RC<Stream> reader)

Creates a Stream that reads Brotli-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.
Note Available only if compiled with BRISK_BROTLI option enabled.


brotliEncoder function

RC<Stream> brotliEncoder(RC<Stream> writer,
                         CompressionLevel level)

Creates a Stream that writes Brotli-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.
Note Available only if compiled with BRISK_BROTLI option enabled.


gzipEncode function

bytes gzipEncode(bytes_view data, CompressionLevel level)

Compresses data using GZip.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.


gzipDecode function

bytes gzipDecode(bytes_view data)

Decompresses GZip-compressed data.
Param data The GZip-compressed input data.
Returns A vector of bytes containing the decompressed data.


zlibEncode function

bytes zlibEncode(bytes_view data, CompressionLevel level)

Compresses data using ZLib.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.


zlibDecode function

bytes zlibDecode(bytes_view data)

Decompresses ZLib-compressed data.
Param data The ZLib-compressed input data.
Returns A vector of bytes containing the decompressed data.


lz4Encode function

bytes lz4Encode(bytes_view data, CompressionLevel level)

Compresses data using LZ4.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.


lz4Decode function

bytes lz4Decode(bytes_view data)

Decompresses LZ4-compressed data.
Param data The LZ4-compressed input data.
Returns A vector of bytes containing the decompressed data.


brotliEncode function

bytes brotliEncode(bytes_view data, CompressionLevel level)

Compresses data using Brotli.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.
Note Available only if compiled with BRISK_BROTLI option enabled.


brotliDecode function

bytes brotliDecode(bytes_view data)

Decompresses Brotli-compressed data.
Param data The Brotli-compressed input data.
Returns A vector of bytes containing the decompressed data.
Note Available only if compiled with BRISK_BROTLI option enabled.


compressionDecoder function

RC<Stream> compressionDecoder(CompressionMethod method,
                              RC<Stream> reader)

Creates a Stream that reads data compressed with a specified compression method.
Param method The compression method to use for decompression.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data.
Note If CompressionMethod::None is used, no decompression is applied.


compressionEncoder function

RC<Stream> compressionEncoder(CompressionMethod method,
                              RC<Stream> writer,
                              CompressionLevel level)

Creates a Stream that writes data using a specified compression method.
Param method The compression method to use for compression.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data.
Note If CompressionMethod::None is used, no compression is applied.


compressionEncode function

bytes compressionEncode(CompressionMethod method,
                        bytes_view data,
                        CompressionLevel level)

Compresses data using the specified compression method.
Param method The compression method to apply.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.
Note If CompressionMethod::None is used, no compression is applied.


compressionDecode function

bytes compressionDecode(CompressionMethod method,
                        bytes_view data)

Decompresses data using the specified compression method.
Param method The compression method to use for decompression.
Param data The compressed input data.
Returns A vector of bytes containing the decompressed data.
Note If CompressionMethod::None is used, no decompression is applied.


Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/