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

Function CopyStream

cpp/src/arrow/filesystem/util_internal.cc:43–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43Status CopyStream(const std::shared_ptr<io::InputStream>& src,
44 const std::shared_ptr<io::OutputStream>& dest, int64_t chunk_size,
45 const io::IOContext& io_context) {
46 ARROW_ASSIGN_OR_RAISE(auto chunk, AllocateBuffer(chunk_size, io_context.pool()));
47
48 while (true) {
49 ARROW_ASSIGN_OR_RAISE(int64_t bytes_read,
50 src->Read(chunk_size, chunk->mutable_data()));
51 if (bytes_read == 0) {
52 // EOF
53 break;
54 }
55 RETURN_NOT_OK(dest->Write(chunk->data(), bytes_read));
56 }
57
58 return Status::OK();
59}
60
61Status PathNotFound(std::string_view path) {
62 return Status::IOError("Path does not exist '", path, "'")

Callers 2

CopyFileMethod · 0.85
CopyFilesFunction · 0.85

Calls 3

OKFunction · 0.50
WriteMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected