#pragma once #include #include namespace DB { class Bzip2WriteBuffer : public BufferWithOwnMemory { public: Bzip2WriteBuffer( std::unique_ptr out_, int compression_level, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, char * existing_memory = nullptr, size_t alignment = 0); ~Bzip2WriteBuffer() override; void finalize() override { finish(); } private: void nextImpl() override; void finish(); void finishImpl(); class Bzip2StateWrapper; std::unique_ptr bz; std::unique_ptr out; bool finished = false; }; }