2012-02-27 06:28:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-08-14 04:42:04 +00:00
|
|
|
#include <cstddef>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <IO/ReadBuffer.h>
|
2012-02-27 06:28:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-08-14 04:26:52 +00:00
|
|
|
/** Allows to read from another ReadBuffer no more than the specified number of bytes.
|
2012-02-27 06:28:20 +00:00
|
|
|
*/
|
2017-08-14 04:30:37 +00:00
|
|
|
class LimitReadBuffer : public ReadBuffer
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
ReadBuffer & in;
|
|
|
|
size_t limit;
|
2017-08-14 03:38:32 +00:00
|
|
|
|
2017-08-14 04:42:04 +00:00
|
|
|
bool nextImpl() override;
|
2017-08-14 03:38:32 +00:00
|
|
|
|
2017-08-14 04:30:37 +00:00
|
|
|
public:
|
2017-08-14 04:42:04 +00:00
|
|
|
LimitReadBuffer(ReadBuffer & in_, size_t limit_);
|
|
|
|
~LimitReadBuffer() override;
|
2017-08-14 04:30:37 +00:00
|
|
|
};
|
2012-02-27 06:28:20 +00:00
|
|
|
|
|
|
|
}
|