23 #define ZSTD_STATIC_LINKING_ONLY 26 #include "circularbuffer.h" 37 const char*
what()
const throw();
43 inline size_t check(
size_t code) {
44 if (ZSTD_isError(code)) {
55 static constexpr
int defaultLevel = 5;
60 size_t init(
int level = defaultLevel);
61 size_t compress(ZSTD_outBuffer* output, ZSTD_inBuffer* input);
62 size_t flush(ZSTD_outBuffer* output);
63 size_t end(ZSTD_outBuffer* output);
77 size_t decompress(ZSTD_outBuffer* output, ZSTD_inBuffer* input);
91 using int_type =
typename std::streambuf::int_type;
96 ssize_t compress(
size_t pos);
98 std::streambuf* sbuf_;
101 std::vector<char> inbuf_;
102 std::vector<char> outbuf_;
115 virtual std::streambuf::int_type underflow();
118 std::streambuf* sbuf_;
120 std::vector<char> inbuf_;
121 std::vector<char> outbuf_;
125 bool detected_ =
false;
126 bool compressed_ =
false;
151 template <
typename T>
155 const std::string& path,
156 std::ios_base::openmode mode = std::ios_base::out)
169 const std::string& path,
170 std::ios_base::openmode mode = std::ios_base::out);
173 virtual operator bool()
const;
183 const std::string& path,
184 std::ios_base::openmode mode = std::ios_base::in);
187 operator bool()
const;
Input file stream for Zstd-compressed data.
Definition: zstdstream.h:180
Zstd stream buffer for decompression.
Definition: zstdstream.h:111
fsholder(const std::string &path, std::ios_base::openmode mode=std::ios_base::out)
Definition: zstdstream.h:154
typename std::streambuf::int_type int_type
Definition: zstdstream.h:91
const char * what() const
Definition: zstdstream.cpp:24
Zstd stream buffer for compression.
Definition: zstdstream.h:86
Output stream for Zstd-compressed data.
Definition: zstdstream.h:140
Output file stream that writes Zstd-compressed data.
Definition: zstdstream.h:166
static constexpr int defaultLevel
Definition: zstdstream.h:55
General utilities.
Definition: assert.cpp:7
size_t check(size_t code)
Definition: zstdstream.h:43
Provides stream compression functionality.
Definition: zstdstream.h:53
This class enables [io]fstream below to inherit from [io]stream (required for setting a custom stream...
Definition: zstdstream.h:152
exception(int code)
Definition: zstdstream.cpp:20
T fs_
Definition: zstdstream.h:160
Provides stream decompression functionality.
Definition: zstdstream.h:72
Custom exception for zstd error codes.
Definition: zstdstream.h:34
Definition: zstdstream.h:130