blob: ef0c9611acfc7cbb8c418d9ef6d42f4a4054b460 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#pragma once
#include "const.h"
#include "dictionary.h"
#include <util/generic/ptr.h>
#include <util/stream/input.h>
#include <util/stream/output.h>
/**
* @addtogroup Streams_Archs
* @{
*/
class TBrotliCompress: public IOutputStream {
public:
/**
@param slave stream to write compressed data to
@param quality the higher the quality, the slower and better the compression. Range is 0 to 11.
@param dictionary custom brotli dictionary
@param offset number of bytes already processed by a different encoder instance
*/
explicit TBrotliCompress(IOutputStream* slave,
int quality = NBrotli::BEST_BROTLI_QUALITY,
const TBrotliDictionary* dictionary = nullptr,
size_t offset = 0);
~TBrotliCompress() override;
private:
void DoWrite(const void* buffer, size_t size) override;
void DoFlush() override;
void DoFinish() override;
public:
class TImpl;
THolder<TImpl> Impl_;
};
////////////////////////////////////////////////////////////////////////////////
class TBrotliDecompress: public IInputStream {
public:
/**
@param slave stream to read compressed data from
@param bufferSize approximate size of buffer compressed data is read in
@param dictionary custom brotli dictionary
*/
explicit TBrotliDecompress(IInputStream* slave,
size_t bufferSize = NBrotli::DEFAULT_BROTLI_BUFFER_SIZE,
const TBrotliDictionary* dictionary = nullptr);
~TBrotliDecompress() override;
private:
size_t DoRead(void* buffer, size_t size) override;
private:
class TImpl;
THolder<TImpl> Impl_;
};
/** @} */
|