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

Method RConnectionRandomAccessFile

r/src/io.cpp:385–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

stopFunction · 0.85
ValueUnsafeMethod · 0.80
okMethod · 0.45

Tested by

no test coverage detected