1#include <Compression/CompressionCodecNone.h>
2#include <Compression/CompressionInfo.h>
3#include <Compression/CompressionFactory.h>
4
5
6namespace DB
7{
8
9UInt8 CompressionCodecNone::getMethodByte() const
10{
11 return static_cast<UInt8>(CompressionMethodByte::NONE);
12}
13
14String CompressionCodecNone::getCodecDesc() const
15{
16 return "NONE";
17}
18
19UInt32 CompressionCodecNone::doCompressData(const char * source, UInt32 source_size, char * dest) const
20{
21 memcpy(dest, source, source_size);
22 return source_size;
23}
24
25void CompressionCodecNone::doDecompressData(const char * source, UInt32 /*source_size*/, char * dest, UInt32 uncompressed_size) const
26{
27 memcpy(dest, source, uncompressed_size);
28}
29
30void registerCodecNone(CompressionCodecFactory & factory)
31{
32 factory.registerSimpleCompressionCodec("NONE", static_cast<char>(CompressionMethodByte::NONE), [&] ()
33 {
34 return std::make_shared<CompressionCodecNone>();
35 });
36}
37
38}
39