| 383 | public RConnectionFileInterface { |
| 384 | public: |
| 385 | explicit RConnectionRandomAccessFile(cpp11::sexp connection_sexp) |
| 386 | : RConnectionFileInterface(connection_sexp) { |
| 387 | // save the current position to seek back to it |
| 388 | auto current_pos = Tell(); |
| 389 | if (!current_pos.ok()) { |
| 390 | cpp11::stop("Tell() returned an error"); |
| 391 | } |
| 392 | int64_t initial_pos = current_pos.ValueUnsafe(); |
| 393 | |
| 394 | cpp11::package("base")["seek"](connection_sexp_, 0, "end"); |
| 395 | current_pos = Tell(); |
| 396 | if (!current_pos.ok()) { |
| 397 | cpp11::stop("Tell() returned an error"); |
| 398 | } |
| 399 | size_ = current_pos.ValueUnsafe(); |
| 400 | |
| 401 | auto status = Seek(initial_pos); |
| 402 | if (!status.ok()) { |
| 403 | cpp11::stop("Seek() returned an error"); |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | arrow::Result<int64_t> GetSize() override { return size_; } |
| 408 |
nothing calls this directly
no test coverage detected