27 const size_t asked = size_t(std::min(int64_t(buffer.size()), size - done));
28 const size_t received = pread(buffer.data(), asked, start + done);
31 reading_past_end_of_file();
33 destination.pwrite(buffer.data(), received, start + done);
34 done += int64_t(received);
50 for (int64_t current = from; current < until;)
52 const size_t n0 = pread
55 size_t(std::min(int64_t(buffer.size()), until - current)),
63 const size_t n = destination.pread
65 destination_buffer.data() + n1,
80 reading_past_end_of_file();
82 const int diff = std::memcmp
85 destination_buffer.data(),
92 current += int64_t(n0);
102 throw Exception(
"Trying to read past the end of file");
109 Async_Reader reader(*
this, blob.get_position(), blob.get_end());
110 std::string result(
size_t(blob.get_size()), 0);
111 reader.
read(result.data(), result.size());
113 reading_past_end_of_file();
virtual void copy_to(Abstract_File &destination, int64_t start, int64_t size) const
static void reading_past_end_of_file()
std::string read_blob(Blob blob) const
virtual bool equal_to(const Abstract_File &destination, int64_t from, int64_t until) const
size_t read(char *buffer, size_t capacity)
bool is_end_of_file() const
std::array< char, 1<< 12 > Default_Buffer