mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-12 02:23:14 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
29 lines
616 B
C++
29 lines
616 B
C++
#pragma once
|
|
|
|
#include <Core/Types.h>
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Allows to read from another ReadBuffer no more than the specified number of bytes.
|
|
* Note that the nested ReadBuffer may read slightly more data internally to fill its buffer.
|
|
*/
|
|
class LimitReadBuffer : public ReadBuffer
|
|
{
|
|
private:
|
|
ReadBuffer & in;
|
|
UInt64 limit;
|
|
bool throw_exception;
|
|
std::string exception_message;
|
|
|
|
bool nextImpl() override;
|
|
|
|
public:
|
|
LimitReadBuffer(ReadBuffer & in_, UInt64 limit_, bool throw_exception_, std::string exception_message_ = {});
|
|
~LimitReadBuffer() override;
|
|
};
|
|
|
|
}
|