aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/Bzip2WriteBuffer.h
blob: d0371903487802b67a77a3a6b55af56b31a64fba (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
#pragma once

#include <IO/WriteBuffer.h>
#include <IO/BufferWithOwnMemory.h>
#include <IO/WriteBufferDecorator.h>

namespace DB
{

class Bzip2WriteBuffer : public WriteBufferWithOwnMemoryDecorator
{
public:
    Bzip2WriteBuffer(
        std::unique_ptr<WriteBuffer> out_,
        int compression_level,
        size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
        char * existing_memory = nullptr,
        size_t alignment = 0);

    ~Bzip2WriteBuffer() override;

private:
    void nextImpl() override;

    void finalizeBefore() override;

    class Bzip2StateWrapper;
    std::unique_ptr<Bzip2StateWrapper> bz;
};

}