| 1 | #pragma once | 
|---|---|
| 2 | |
| 3 | #include <IO/ReadBuffer.h> | 
| 4 | #include <IO/BufferWithOwnMemory.h> | 
| 5 | |
| 6 | |
| 7 | namespace DB | 
| 8 | { | 
| 9 | |
| 10 | class BrotliReadBuffer : public BufferWithOwnMemory<ReadBuffer> | 
| 11 | { | 
| 12 | public: | 
| 13 | BrotliReadBuffer( | 
| 14 | std::unique_ptr<ReadBuffer> in_, | 
| 15 | size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, | 
| 16 | char * existing_memory = nullptr, | 
| 17 | size_t alignment = 0); | 
| 18 | |
| 19 | ~BrotliReadBuffer() override; | 
| 20 | |
| 21 | private: | 
| 22 | bool nextImpl() override; | 
| 23 | |
| 24 | std::unique_ptr<ReadBuffer> in; | 
| 25 | |
| 26 | class BrotliStateWrapper; | 
| 27 | std::unique_ptr<BrotliStateWrapper> brotli; | 
| 28 | |
| 29 | size_t in_available; | 
| 30 | const uint8_t * in_data; | 
| 31 | |
| 32 | size_t out_capacity; | 
| 33 | uint8_t * out_data; | 
| 34 | |
| 35 | bool eof; | 
| 36 | }; | 
| 37 | |
| 38 | } | 
| 39 | |
| 40 | 
