aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/ucompress/writer.h
blob: 4d3ae710938b058a8401aa3565864852789317f9 (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 <util/generic/buffer.h>
#include <util/stream/output.h>


namespace NBlockCodecs {
    struct ICodec;
}

namespace NUCompress {
    class TCodedOutput: public IOutputStream {
    public:
        TCodedOutput(IOutputStream* out, const NBlockCodecs::ICodec* c, size_t bufLen = 16 << 20);
        ~TCodedOutput() override;

    private:
        void DoWrite(const void* buf, size_t len) override;
        void DoFlush() override;
        void DoFinish() override;

        void FlushImpl();

    private:
        const NBlockCodecs::ICodec* const C_;
        TBuffer D_;
        TBuffer O_;
        IOutputStream* S_;
        bool HdrWritten = false;
    };
}