Botan  1.11.15
src/lib/compression/bzip2/bzip2.h
Go to the documentation of this file.
00001 /*
00002 * Bzip2 Compressor
00003 * (C) 2001 Peter J Jones
00004 *     2001-2007,2014 Jack Lloyd
00005 *
00006 * Botan is released under the Simplified BSD License (see license.txt)
00007 */
00008 
00009 #ifndef BOTAN_BZIP2_H__
00010 #define BOTAN_BZIP2_H__
00011 
00012 #include <botan/compression.h>
00013 
00014 namespace Botan {
00015 
00016 /**
00017 * Bzip2 Compression
00018 */
00019 class BOTAN_DLL Bzip2_Compression : public Stream_Compression
00020    {
00021    public:
00022       /**
00023       * @param block_size in 1024 KiB increments, in range from 1 to 9.
00024       *
00025       * Lowering this does not noticably modify the compression or
00026       * decompression speed, though less memory is required for both
00027       * compression and decompression.
00028       */
00029       Bzip2_Compression(size_t block_size = 9) : m_block_size(block_size) {}
00030 
00031       std::string name() const override { return "Bzip2_Compression"; }
00032 
00033    private:
00034       Compression_Stream* make_stream() const;
00035 
00036       const size_t m_block_size;
00037    };
00038 
00039 /**
00040 * Bzip2 Deccompression
00041 */
00042 class BOTAN_DLL Bzip2_Decompression : public Stream_Decompression
00043    {
00044    public:
00045       std::string name() const override { return "Bzip2_Decompression"; }
00046    private:
00047       Compression_Stream* make_stream() const;
00048    };
00049 
00050 }
00051 
00052 #endif