| 223 | Status Open(int fd) { return OpenReadable(fd); } |
| 224 | |
| 225 | Result<std::shared_ptr<Buffer>> ReadBuffer(int64_t nbytes) { |
| 226 | ARROW_ASSIGN_OR_RAISE(auto buffer, AllocateResizableBuffer(nbytes, pool_)); |
| 227 | |
| 228 | ARROW_ASSIGN_OR_RAISE(int64_t bytes_read, Read(nbytes, buffer->mutable_data())); |
| 229 | if (bytes_read < nbytes) { |
| 230 | RETURN_NOT_OK(buffer->Resize(bytes_read)); |
| 231 | buffer->ZeroPadding(); |
| 232 | } |
| 233 | // R build with openSUSE155 requires an explicit shared_ptr construction |
| 234 | return std::shared_ptr<Buffer>(std::move(buffer)); |
| 235 | } |
| 236 | |
| 237 | Result<std::shared_ptr<Buffer>> ReadBufferAt(int64_t position, int64_t nbytes) { |
| 238 | ARROW_ASSIGN_OR_RAISE(auto buffer, AllocateResizableBuffer(nbytes, pool_)); |