| 210 | } |
| 211 | |
| 212 | Result<std::unique_ptr<Message>> Message::ReadFrom(std::shared_ptr<Buffer> metadata, |
| 213 | io::InputStream* stream) { |
| 214 | std::unique_ptr<Message> result; |
| 215 | auto listener = std::make_shared<AssignMessageDecoderListener>(&result); |
| 216 | MessageDecoder decoder(listener, MessageDecoder::State::METADATA, metadata->size()); |
| 217 | ARROW_RETURN_NOT_OK(decoder.Consume(metadata)); |
| 218 | |
| 219 | ARROW_ASSIGN_OR_RAISE(auto body, stream->Read(decoder.next_required_size())); |
| 220 | if (body->size() < decoder.next_required_size()) { |
| 221 | return Status::IOError("Expected to be able to read ", decoder.next_required_size(), |
| 222 | " bytes for message body, got ", body->size()); |
| 223 | } |
| 224 | RETURN_NOT_OK(decoder.Consume(body)); |
| 225 | return result; |
| 226 | } |
| 227 | |
| 228 | Result<std::unique_ptr<Message>> Message::ReadFrom(const int64_t offset, |
| 229 | std::shared_ptr<Buffer> metadata, |
nothing calls this directly
no test coverage detected