class
Compression
Performs generic compression and decompression on raw data.
Public
Methods
staticCompress
static u64 Compress(DataStream &input, DataStream &output, u64 inputDataSize = 0, CompressionType compressionType = CompressionType::Default, std::function<void (float)> reportProgress = nullptr)
Compresses the data from the provided data stream and outputs the new stream with compressed data.
- input
- Input stream from which to read the data to compress. Data will be read from the current cursor position of the stream. Stream cursor will be advanced as the data is read.
- output
- Output stream into which to write the compressed data.
- inputDataSize
- Size of the data to read from the input. Once this size is reached we will end the process. If 0, we will compress until the input stream end is reached.
- compressionType
- Type of compression to use.
- reportProgress
- Optional callback to trigger reporting of the compression progress. Reported value will be in range [0, 1].
Returns: Size of the compressed data written.
staticDecompress
static bool Decompress(DataStream &input, DataStream &output, u64 inputDataSize = 0, CompressionType compressionType = CompressionType::Default, std::function<void (float)> reportProgress = nullptr)
Decompresses the data from the provided data stream and outputs the new stream with decompressed data.
- input
- Input stream from which to read the data to decompress. Data will be read from the current cursor position of the stream. Stream cursor will be advanced as the data is read.
- output
- Output stream into which to write the decompressed data.
- inputDataSize
- Size of the data to read from the input. Once this size is reached we will end the process. If 0, we will decompress until the input stream end is reached.
- compressionType
- Type of compression used on the compressed data.
- reportProgress
- Optional callback to trigger reporting of the decompression progress. Reported value will be in range [0, 1].
Returns: True if successful.