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

Class InputStreamBlockIterator

cpp/src/arrow/io/interfaces.cc:79–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77namespace {
78
79class InputStreamBlockIterator {
80 public:
81 InputStreamBlockIterator(std::shared_ptr<InputStream> stream, int64_t block_size)
82 : stream_(std::move(stream)), block_size_(block_size) {}
83
84 Result<std::shared_ptr<Buffer>> Next() {
85 if (done_) {
86 return nullptr;
87 }
88
89 ARROW_ASSIGN_OR_RAISE(auto out, stream_->Read(block_size_));
90
91 if (out->size() == 0) {
92 done_ = true;
93 stream_.reset();
94 out.reset();
95 }
96
97 return out;
98 }
99
100 protected:
101 std::shared_ptr<InputStream> stream_;
102 int64_t block_size_;
103 bool done_ = false;
104};
105
106} // namespace
107

Callers 1

MakeInputStreamIteratorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected