| 97 | size_t size() const override { return file_size_; } |
| 98 | |
| 99 | char get(size_t pos) const override { |
| 100 | if (pos >= file_size_) throw std::out_of_range("get out of range"); |
| 101 | const size_t pidx = pos / page_size_; |
| 102 | const FileReader::Page& p = fetchPage_(pidx); |
| 103 | const size_t off = pos % page_size_; |
| 104 | if (off >= p.data.size()) throw std::out_of_range("offset beyond valid page bytes"); |
| 105 | return p.data[off]; |
| 106 | } |
| 107 | |
| 108 | private: |
| 109 | const FileReader::Page& fetchPage_(size_t idx) const { |