2017-01-03 01:42:17 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <IO/ReadBuffer.h>
|
2017-01-03 01:42:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Allows to read from memory range.
|
|
|
|
* In comparison with just ReadBuffer, it only adds convenient constructors, that do const_cast.
|
|
|
|
* In fact, ReadBuffer will not modify data in buffer, but it requires non-const pointer.
|
|
|
|
*/
|
|
|
|
class ReadBufferFromMemory : public ReadBuffer
|
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
ReadBufferFromMemory(const char * buf, size_t size)
|
|
|
|
: ReadBuffer(const_cast<char *>(buf), size, 0) {}
|
2017-01-03 01:42:17 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
ReadBufferFromMemory(const unsigned char * buf, size_t size)
|
|
|
|
: ReadBuffer(const_cast<char *>(reinterpret_cast<const char *>(buf)), size, 0) {}
|
2017-01-03 01:42:17 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
ReadBufferFromMemory(const signed char * buf, size_t size)
|
|
|
|
: ReadBuffer(const_cast<char *>(reinterpret_cast<const char *>(buf)), size, 0) {}
|
2017-01-03 01:42:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|