| 372 | } |
| 373 | |
| 374 | Status DoBuffer() { |
| 375 | // Fill the buffer from the raw stream with at most `buffer_size_` bytes. |
| 376 | if (!buffer_) { |
| 377 | RETURN_NOT_OK(ResetBuffer()); |
| 378 | } |
| 379 | |
| 380 | int64_t bytes_to_buffer = buffer_size_; |
| 381 | if (raw_read_bound_ >= 0) { |
| 382 | bytes_to_buffer = std::min(buffer_size_, raw_read_bound_ - raw_read_total_); |
| 383 | } |
| 384 | ARROW_ASSIGN_OR_RAISE(bytes_buffered_, raw_->Read(bytes_to_buffer, buffer_data_)); |
| 385 | buffer_pos_ = 0; |
| 386 | raw_read_total_ += bytes_buffered_; |
| 387 | |
| 388 | // Do not make assumptions about the raw stream position |
| 389 | raw_pos_ = -1; |
| 390 | return Status::OK(); |
| 391 | } |
| 392 | |
| 393 | Status BufferIfNeeded() { |
| 394 | if (bytes_buffered_ == 0) { |
nothing calls this directly
no test coverage detected