ClickHouse/dbms/src/IO/SeekableReadBuffer.h

31 lines
759 B
C++
Raw Normal View History

#pragma once
#include <IO/ReadBuffer.h>
2020-01-27 19:17:22 +00:00
namespace DB
{
2020-01-27 19:17:22 +00:00
class SeekableReadBuffer : public ReadBuffer
{
public:
SeekableReadBuffer(Position ptr, size_t size)
: ReadBuffer(ptr, size) {}
SeekableReadBuffer(Position ptr, size_t size, size_t offset)
: ReadBuffer(ptr, size, offset) {}
2020-01-27 19:51:48 +00:00
/**
* Shifts buffer current position to given offset.
* @param off Offset.
* @param whence Seek mode (@see SEEK_SET, @see SEEK_CUR).
* @return New position from the begging of underlying buffer / file.
*/
virtual off_t seek(off_t off, int whence) = 0;
2020-02-14 14:28:33 +00:00
/**
* @return Offset from the begging of underlying buffer / file corresponds to buffer current position.
*/
virtual off_t getPosition() = 0;
};
}