| 218 | bool closed() const override { return closed_ || !stream_.IsOpen(); } |
| 219 | |
| 220 | Status Write(const void* data, int64_t nbytes) override { |
| 221 | if (closed()) return Status::Invalid("Cannot write to a closed stream"); |
| 222 | if (stream_.write(reinterpret_cast<const char*>(data), nbytes)) { |
| 223 | tell_ += nbytes; |
| 224 | return Status::OK(); |
| 225 | } |
| 226 | return internal::ToArrowStatus(stream_.last_status()); |
| 227 | } |
| 228 | |
| 229 | Status Flush() override { |
| 230 | if (closed()) return Status::Invalid("Cannot flush a closed stream"); |