18 using std::unique_ptr;
22 : totalLen_(totalLen) {
25 dDict_ = ZSTD_createDDict(&dictStr, dictStr.length());
32 ZSTD_isError(ZSTD_initDStream(
dStream_))) {
56 size_t buffOutSize = ZSTD_DStreamOutSize();
57 std::unique_ptr<unsigned char[]> buffOut(
new unsigned char[buffOutSize]);
61 ZSTD_inBuffer input = {
range.data(),
range.size(), 0};
62 while (input.pos < input.size) {
63 ZSTD_outBuffer
output = {buffOut.get(), buffOutSize, 0};
64 size_t toRead = ZSTD_decompressStream(
dStream_, &output, &input);
66 if (ZSTD_isError(toRead)) {
77 appender.pushAtMost((
const uint8_t*)output.dst, output.pos);
78 CHECK(copied == output.pos);
~ZstdStreamDecompressor()
std::unique_ptr< folly::IOBuf > decompress(const folly::IOBuf *in)
static std::unique_ptr< IOBuf > create(std::size_t capacity)
Gen range(Value begin, Value end)
ZstdStreamDecompressor(size_t, std::string)