| 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_; |