aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/streams/lz/lz4/lz4.h
blob: 24d66c80719dbe0db33e9108d5af0b50a2aa4b09 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include <util/stream/output.h>
#include <util/stream/input.h>
#include <util/generic/ptr.h>

/**
 * @addtogroup Streams_Archs
 * @{
 */

/**
 * Lz4 compressing stream.
 *
 * @see http://code.google.com/p/lz4/
 */
class TLz4Compress: public IOutputStream {
public:
    TLz4Compress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15);
    ~TLz4Compress() override;

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

private:
    class TImpl;
    THolder<TImpl> Impl_;
};

/**
 * Lz4 decompressing stream.
 *
 * @see http://code.google.com/p/lz4/
 */
class TLz4Decompress: public IInputStream {
public:
    TLz4Decompress(IInputStream* slave);
    ~TLz4Decompress() override;

private:
    size_t DoRead(void* buf, size_t len) override;

private:
    class TImpl;
    THolder<TImpl> Impl_;
};

/** @} */