MCPcopy Create free account
hub / github.com/apache/arrow / WriteChunkwise

Method WriteChunkwise

cpp/src/arrow/io/buffered_test.cc:117–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115 }
116
117 void WriteChunkwise(const std::string& datastr, const std::valarray<int64_t>& sizes) {
118 const char* data = datastr.data();
119 const int64_t data_size = static_cast<int64_t>(datastr.size());
120 int64_t data_pos = 0;
121 auto size_it = std::begin(sizes);
122
123 // Write datastr, chunk by chunk, until exhausted
124 while (true) {
125 int64_t size = *size_it++;
126 if (size_it == std::end(sizes)) {
127 size_it = std::begin(sizes);
128 }
129 if (data_pos + size > data_size) {
130 break;
131 }
132 ASSERT_OK(buffered_->Write(data + data_pos, size));
133 data_pos += size;
134 }
135 ASSERT_OK(buffered_->Write(data + data_pos, data_size - data_pos));
136 }
137};
138
139TEST_F(TestBufferedOutputStream, DestructorClosesFile) {

Callers

nothing calls this directly

Calls 5

beginFunction · 0.50
endFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected