aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/streams/lz/snappy/snappy.h
blob: 2e680217aabc9474da38117a5abe5aba9a71f558 (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
 * @{
 */

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

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

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

/**
 * Snappy decompressing stream.
 *
 * @see http://code.google.com/p/snappy/
 */
class TSnappyDecompress: public IInputStream {
public:
    TSnappyDecompress(IInputStream* slave);
    ~TSnappyDecompress() override;

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

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

/** @} */