MCPcopy Create free account
hub / github.com/apache/orc / compressInternal

Method compressInternal

c++/src/Compression.cc:226–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224 }
225
226 void CompressionStream::compressInternal() {
227 if (rawInputBuffer.size() != 0) {
228 ensureHeader();
229
230 uint64_t preSize = getSize();
231 uint64_t totalCompressedSize = doStreamingCompression();
232 if (totalCompressedSize >= static_cast<unsigned long>(rawInputBuffer.size())) {
233 writeHeader(static_cast<size_t>(rawInputBuffer.size()), true);
234 // reset output buffer
235 outputBuffer = nullptr;
236 outputPosition = outputSize = 0;
237 uint64_t backup = getSize() - preSize;
238 BufferedOutputStream::BackUp(static_cast<int>(backup));
239
240 // copy raw input buffer into block buffer
241 uint64_t blockNumber = rawInputBuffer.getBlockNumber();
242 for (uint64_t i = 0; i < blockNumber; ++i) {
243 auto block = rawInputBuffer.getBlock(i);
244 writeData(reinterpret_cast<const unsigned char*>(block.data), block.size);
245 }
246 } else {
247 writeHeader(totalCompressedSize, false);
248 }
249 rawInputBuffer.resize(0);
250 }
251 }
252
253 bool CompressionStream::Next(void** data, int* size) {
254 if (rawInputBuffer.size() > compressionBlockSize) {

Callers

nothing calls this directly

Calls 4

getBlockNumberMethod · 0.80
getBlockMethod · 0.80
sizeMethod · 0.65
resizeMethod · 0.45

Tested by

no test coverage detected