MCPcopy Create free account
hub / github.com/PDAL/PDAL / finish

Method finish

io/BpfCompressor.cpp:100–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100void BpfCompressor::finish()
101{
102 // Pop our special stream so that we can write the the file.
103 delete m_out.popStream();
104
105 // Deflate and write the result to the output file.
106 int ret = Z_OK;
107 while (ret == Z_OK)
108 {
109 ret = ::deflate(&m_strm, Z_FINISH);
110 size_t written = CHUNKSIZE - m_strm.avail_out;
111 m_compressedSize += written;
112 m_out.put(m_tmpbuf, written);
113 m_strm.avail_out = CHUNKSIZE;
114 m_strm.next_out = m_tmpbuf;
115 }
116 if (ret != Z_STREAM_END)
117 throw error("Couldn't close BPF compression stream.");
118 deflateEnd(&m_strm);
119
120 // Mark our position so that we can get back here.
121 OStreamMarker blockEnd(m_out);
122
123 // Rewind to the start of the block and write the size bytes.
124 m_blockStart.rewind();
125 m_out << (uint32_t)m_rawSize << (uint32_t)m_compressedSize;
126
127 // Set the position back to the end of the block.
128 blockEnd.rewind();
129}
130
131#else
132

Callers 3

writePointMajorMethod · 0.45
writeDimMajorMethod · 0.45
writeByteMajorMethod · 0.45

Calls 3

errorClass · 0.70
putMethod · 0.45
rewindMethod · 0.45

Tested by

no test coverage detected