ClickHouse/src/IO/ReadBufferFromFileBase.cpp

35 lines
748 B
C++
Raw Normal View History

#include <IO/ReadBufferFromFileBase.h>
namespace DB
{
2022-05-25 14:49:40 +00:00
namespace ErrorCodes
{
extern const int NOT_IMPLEMENTED;
}
ReadBufferFromFileBase::ReadBufferFromFileBase() : BufferWithOwnMemory<SeekableReadBuffer>(0)
{
}
ReadBufferFromFileBase::ReadBufferFromFileBase(
size_t buf_size,
char * existing_memory,
size_t alignment,
std::optional<size_t> file_size_)
: BufferWithOwnMemory<SeekableReadBuffer>(buf_size, existing_memory, alignment)
, file_size(file_size_)
{
}
2020-03-08 21:18:53 +00:00
ReadBufferFromFileBase::~ReadBufferFromFileBase() = default;
2022-05-25 14:49:40 +00:00
size_t ReadBufferFromFileBase::getFileSize()
{
if (file_size)
return *file_size;
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot find out file size for read buffer");
}
}