Outputs sizes of uncompressed and compressed blocks for compressed file.
| 35 | |
| 36 | /// Outputs sizes of uncompressed and compressed blocks for compressed file. |
| 37 | void checkAndWriteHeader(DB::ReadBuffer & in, DB::WriteBuffer & out) |
| 38 | { |
| 39 | while (!in.eof()) |
| 40 | { |
| 41 | in.ignore(16); /// checksum |
| 42 | |
| 43 | char header[COMPRESSED_BLOCK_HEADER_SIZE]; |
| 44 | in.readStrict(header, COMPRESSED_BLOCK_HEADER_SIZE); |
| 45 | |
| 46 | UInt32 size_compressed = unalignedLoad<UInt32>(&header[1]); |
| 47 | |
| 48 | if (size_compressed > DBMS_MAX_COMPRESSED_SIZE) |
| 49 | throw DB::Exception("Too large size_compressed. Most likely corrupted data.", DB::ErrorCodes::TOO_LARGE_SIZE_COMPRESSED); |
| 50 | |
| 51 | UInt32 size_decompressed = unalignedLoad<UInt32>(&header[5]); |
| 52 | |
| 53 | DB::writeText(size_decompressed, out); |
| 54 | DB::writeChar('\t', out); |
| 55 | DB::writeText(size_compressed, out); |
| 56 | DB::writeChar('\n', out); |
| 57 | |
| 58 | in.ignore(size_compressed - COMPRESSED_BLOCK_HEADER_SIZE); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | } |
| 63 |
no test coverage detected