MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / writeFetchedBody

Method writeFetchedBody

extensions/aws/s3/S3WrapperBase.cpp:144–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144int64_t S3WrapperBase::writeFetchedBody(Aws::IOStream& source, const int64_t data_size, const std::shared_ptr<io::BaseStream>& output) {
145 static const uint64_t BUFFER_SIZE = 4096;
146 std::vector<uint8_t> buffer;
147 buffer.reserve(BUFFER_SIZE);
148
149 int64_t write_size = 0;
150 while (write_size < data_size) {
151 auto next_write_size = data_size - write_size < BUFFER_SIZE ? data_size - write_size : BUFFER_SIZE;
152 if (!source.read(reinterpret_cast<char*>(buffer.data()), next_write_size)) {
153 return -1;
154 }
155 auto ret = output->write(buffer.data(), next_write_size);
156 if (ret < 0) {
157 return ret;
158 }
159 write_size += next_write_size;
160 }
161 return write_size;
162}
163
164minifi::utils::optional<GetObjectResult> S3WrapperBase::getObject(const GetObjectRequestParameters& get_object_params, const std::shared_ptr<io::BaseStream>& out_body) {
165 Aws::S3::Model::GetObjectRequest request;

Callers

nothing calls this directly

Calls 2

readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected