2020-10-31 23:56:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
|
2020-11-12 09:21:33 +00:00
|
|
|
#if !defined(ARCADIA_BUILD)
|
|
|
|
#include <lzma.h> // Y_IGNORE
|
|
|
|
#endif
|
2020-10-31 23:56:41 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-11-12 09:21:33 +00:00
|
|
|
#if !defined(ARCADIA_BUILD)
|
2020-11-09 22:52:22 +00:00
|
|
|
class LZMAInflatingReadBuffer : public BufferWithOwnMemory<ReadBuffer>
|
2020-10-31 23:56:41 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-11-09 22:52:22 +00:00
|
|
|
LZMAInflatingReadBuffer(
|
2020-10-31 23:56:41 +00:00
|
|
|
std::unique_ptr<ReadBuffer> in_,
|
|
|
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
|
|
|
char * existing_memory = nullptr,
|
|
|
|
size_t alignment = 0);
|
|
|
|
|
2020-11-09 22:52:22 +00:00
|
|
|
~LZMAInflatingReadBuffer() override;
|
2020-10-31 23:56:41 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool nextImpl() override;
|
|
|
|
|
|
|
|
std::unique_ptr<ReadBuffer> in;
|
2020-11-11 01:50:56 +00:00
|
|
|
lzma_stream lstr;
|
2020-11-09 22:52:22 +00:00
|
|
|
|
2020-10-31 23:56:41 +00:00
|
|
|
bool eof;
|
|
|
|
};
|
2020-11-12 09:21:33 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
class LZMAInflatingReadBuffer : public BufferWithOwnMemory<ReadBuffer>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LZMAInflatingReadBuffer(
|
|
|
|
std::unique_ptr<ReadBuffer> in_ [[maybe_unused]],
|
|
|
|
size_t buf_size [[maybe_unused]] = DBMS_DEFAULT_BUFFER_SIZE,
|
|
|
|
char * existing_memory [[maybe_unused]] = nullptr,
|
|
|
|
size_t alignment [[maybe_unused]] = 0)
|
|
|
|
{
|
|
|
|
throw Exception("LZMADeflatingWriteBuffer is not implemented for arcadia build", ErrorCodes::NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2020-11-03 23:47:39 +00:00
|
|
|
}
|