| 300 | }; |
| 301 | |
| 302 | Result<std::shared_ptr<InputStream>> RandomAccessFile::GetStream( |
| 303 | std::shared_ptr<RandomAccessFile> file, int64_t file_offset, int64_t nbytes) { |
| 304 | if (file_offset < 0) { |
| 305 | return Status::Invalid("file_offset should be a positive value, got: ", file_offset); |
| 306 | } |
| 307 | if (nbytes < 0) { |
| 308 | return Status::Invalid("nbytes should be a positive value, got: ", nbytes); |
| 309 | } |
| 310 | return std::make_shared<FileSegmentReader>(std::move(file), file_offset, nbytes); |
| 311 | } |
| 312 | |
| 313 | // ----------------------------------------------------------------------- |
| 314 | // Implement utilities exported from concurrency.h and util_internal.h |