2019-02-04 22:15:08 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
|
|
|
|
|
|
|
2019-02-05 23:12:31 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2019-02-04 22:15:08 +00:00
|
|
|
|
2019-02-05 23:12:31 +00:00
|
|
|
class BrotliReadBuffer : public BufferWithOwnMemory<ReadBuffer>
|
|
|
|
{
|
2019-02-04 22:15:08 +00:00
|
|
|
public:
|
|
|
|
BrotliReadBuffer(
|
2019-11-19 13:57:54 +00:00
|
|
|
std::unique_ptr<ReadBuffer> in_,
|
2019-02-04 22:15:08 +00:00
|
|
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
2019-02-12 13:01:14 +00:00
|
|
|
char * existing_memory = nullptr,
|
2019-02-04 22:15:08 +00:00
|
|
|
size_t alignment = 0);
|
|
|
|
|
|
|
|
~BrotliReadBuffer() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool nextImpl() override;
|
|
|
|
|
2019-11-19 13:57:54 +00:00
|
|
|
std::unique_ptr<ReadBuffer> in;
|
2019-02-05 23:12:31 +00:00
|
|
|
|
2019-02-11 20:42:46 +00:00
|
|
|
class BrotliStateWrapper;
|
|
|
|
std::unique_ptr<BrotliStateWrapper> brotli;
|
2019-02-05 23:12:31 +00:00
|
|
|
|
|
|
|
size_t in_available;
|
|
|
|
const uint8_t * in_data;
|
|
|
|
|
|
|
|
size_t out_capacity;
|
|
|
|
uint8_t * out_data;
|
|
|
|
|
2019-02-04 22:15:08 +00:00
|
|
|
bool eof;
|
|
|
|
};
|
2019-04-10 16:12:31 +00:00
|
|
|
|
2019-02-06 06:05:41 +00:00
|
|
|
}
|
|
|
|
|