aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/streams/bzip2/bzip2.h
blob: e007ab9b6cf417f347a21f39cdb4b812f0357115 (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
51
52
53
#pragma once
 
#include <util/stream/input.h> 
#include <util/stream/output.h> 
#include <util/generic/ptr.h>
#include <util/generic/yexception.h>
 
#define BZIP_BUF_LEN (8 * 1024) 
#define BZIP_COMPRESSION_LEVEL 6 
 
/**
 * @addtogroup Streams_Archs
 * @{
 */

class TBZipException: public yexception { 
}; 
 
class TBZipDecompressError: public TBZipException { 
}; 
 
class TBZipCompressError: public TBZipException { 
}; 
 
class TBZipDecompress: public IInputStream {
public: 
    TBZipDecompress(IInputStream* input, size_t bufLen = BZIP_BUF_LEN);
    ~TBZipDecompress() override;
 
private: 
    size_t DoRead(void* buf, size_t size) override;
 
private: 
    class TImpl; 
    THolder<TImpl> Impl_; 
}; 
 
class TBZipCompress: public IOutputStream {
public: 
    TBZipCompress(IOutputStream* out, size_t compressionLevel = BZIP_COMPRESSION_LEVEL, size_t bufLen = BZIP_BUF_LEN);
    ~TBZipCompress() override;
 
private: 
    void DoWrite(const void* buf, size_t size) override;
    void DoFlush() override;
    void DoFinish() override;
 
public: 
    class TImpl; 
    THolder<TImpl> Impl_; 
}; 
 
/** @} */