mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
40 lines
852 B
C++
40 lines
852 B
C++
#pragma once
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
#include <IO/CompressionMethod.h>
|
|
|
|
#include <zlib.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
namespace ErrorCodes
|
|
{
|
|
}
|
|
|
|
/// Reads compressed data from ReadBuffer in_ and performs decompression using zlib library.
|
|
/// This buffer is able to seamlessly decompress multiple concatenated zlib streams.
|
|
class ZlibInflatingReadBuffer : public BufferWithOwnMemory<ReadBuffer>
|
|
{
|
|
public:
|
|
ZlibInflatingReadBuffer(
|
|
std::unique_ptr<ReadBuffer> in_,
|
|
CompressionMethod compression_method,
|
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
|
char * existing_memory = nullptr,
|
|
size_t alignment = 0);
|
|
|
|
~ZlibInflatingReadBuffer() override;
|
|
|
|
private:
|
|
bool nextImpl() override;
|
|
|
|
std::unique_ptr<ReadBuffer> in;
|
|
z_stream zstr;
|
|
bool eof;
|
|
};
|
|
|
|
}
|