MCPcopy Create free account
hub / github.com/apache/arrow / FileReadAt

Function FileReadAt

cpp/src/arrow/util/io_util.cc:1689–1709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1687}
1688
1689Result<int64_t> FileReadAt(int fd, uint8_t* buffer, int64_t position, int64_t nbytes) {
1690 int64_t bytes_read = 0;
1691
1692 while (bytes_read < nbytes) {
1693 int64_t chunksize =
1694 std::min(static_cast<int64_t>(ARROW_MAX_IO_CHUNKSIZE), nbytes - bytes_read);
1695 int64_t ret = pread_compat(fd, buffer, chunksize, position);
1696
1697 if (ret == -1) {
1698 return IOErrorFromErrno(errno, "Error reading bytes from file");
1699 }
1700 if (ret == 0) {
1701 // EOF
1702 break;
1703 }
1704 buffer += ret;
1705 position += ret;
1706 bytes_read += ret;
1707 }
1708 return bytes_read;
1709}
1710
1711//
1712// Writing data

Callers 1

ReadAtMethod · 0.85

Calls 2

pread_compatFunction · 0.85
IOErrorFromErrnoFunction · 0.85

Tested by

no test coverage detected