NCBI C++ ToolKit
|
Search Toolkit Book for CZipCompressor
CZipCompressor – zlib based compressor. More...
#include <util/compress/zlib.hpp>
Public Member Functions | |
CZipCompressor (ELevel level=eLevel_Default, TZipFlags flags=0) | |
Constructor. More... | |
virtual | ~CZipCompressor (void) |
Destructor. More... | |
void | SetFileInfo (const SFileInfo &info) |
Set information about compressed file. More... | |
virtual bool | AllowEmptyData () const |
Return TRUE if fAllowEmptyData flag is set. More... | |
Public Member Functions inherited from CZipCompression | |
CZipCompression (ELevel level=eLevel_Default) | |
Constructor. More... | |
virtual | ~CZipCompression (void) |
Destructor. More... | |
virtual CVersionInfo | GetVersion (void) const |
Return name and version of the compression library. More... | |
virtual ELevel | GetDefaultLevel (void) const |
Returns default compression level for a compression algorithm. More... | |
virtual bool | HaveSupport (ESupportFeature feature) |
Check if compression have support for a specified feature. More... | |
virtual bool | CompressBuffer (const void *src_buf, size_t src_len, void *dst_buf, size_t dst_size, size_t *dst_len) |
Compress data in the buffer. More... | |
virtual bool | DecompressBuffer (const void *src_buf, size_t src_len, void *dst_buf, size_t dst_size, size_t *dst_len) |
Decompress data in the buffer. More... | |
virtual size_t | EstimateCompressionBufferSize (size_t src_len) |
Estimate buffer size for data compression. More... | |
virtual bool | CompressFile (const string &src_file, const string &dst_file, size_t file_io_bufsize=kCompressionDefaultBufSize, size_t compression_in_bufsize=kCompressionDefaultBufSize, size_t compression_out_bufsize=kCompressionDefaultBufSize) |
Compress file. More... | |
virtual bool | DecompressFile (const string &src_file, const string &dst_file, size_t file_io_bufsize=kCompressionDefaultBufSize, size_t decompression_in_bufsize=kCompressionDefaultBufSize, size_t decompression_out_bufsize=kCompressionDefaultBufSize) |
Decompress file. More... | |
virtual bool | DecompressFileIntoDir (const string &src_file, const string &dst_dir, size_t file_io_bufsize=kCompressionDefaultBufSize, size_t decompression_in_bufsize=kCompressionDefaultBufSize, size_t decompression_out_bufsize=kCompressionDefaultBufSize) |
Decompress file into specified directory. More... | |
virtual bool | SetDictionary (CCompressionDictionary &dict, ENcbiOwnership own=eNoOwnership) |
Set a dictionary for all compression/decompression operations. More... | |
void | SetStrategy (int strategy) |
Compression strategy. More... | |
int | GetStrategy (void) const |
void | SetMemoryLevel (int mem_level) |
Memory level. More... | |
int | GetMemoryLevel (void) const |
void | SetWindowBits (int window_bits) |
Window bits. More... | |
int | GetWindowBits (void) const |
Public Member Functions inherited from CCompression | |
CCompression (ELevel level=eLevel_Default) | |
virtual | ~CCompression (void) |
virtual void | SetLevel (ELevel level) |
Get/set compression level. More... | |
virtual ELevel | GetLevel (void) const |
virtual int | GetErrorCode (void) const |
Get compressor's internal status/error code and description for the last operation. More... | |
virtual string | GetErrorDescription (void) const |
virtual TFlags | GetFlags (void) const |
Get/set flags. More... | |
virtual void | SetFlags (TFlags flags) |
Public Member Functions inherited from ICompression | |
virtual | ~ICompression (void) |
Destructor. More... | |
Public Member Functions inherited from CCompressionProcessor | |
CCompressionProcessor (void) | |
virtual | ~CCompressionProcessor (void) |
bool | IsBusy (void) const |
Return compressor's busy flag. More... | |
size_t | GetProcessedSize (void) |
size_t | GetOutputSize (void) |
Protected Member Functions | |
virtual EStatus | Init (void) |
Initialize the internal stream state for compression/decompression. More... | |
virtual EStatus | Process (const char *in_buf, size_t in_len, char *out_buf, size_t out_size, size_t *in_avail, size_t *out_avail) |
Compress/decompress as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. More... | |
virtual EStatus | Flush (char *out_buf, size_t out_size, size_t *out_avail) |
Flush compressed/decompressed data from the output buffer. More... | |
virtual EStatus | Finish (char *out_buf, size_t out_size, size_t *out_avail) |
Finish the compression/decompression process. More... | |
virtual EStatus | End (int abandon=0) |
Free all dynamically allocated data structures. More... | |
Protected Member Functions inherited from CZipCompression | |
string | FormatErrorMessage (string where, size_t pos=0) const |
Format string with last error description. More... | |
Protected Member Functions inherited from CCompression | |
void | SetError (int status, const char *description=0) |
Set last action error/status code and description. More... | |
void | SetError (int status, const string &description) |
virtual bool | x_CompressFile (const string &src_file, CCompressionFile &dst_file, size_t file_io_bufsize=kCompressionDefaultBufSize) |
Universal file compression function. More... | |
virtual bool | x_DecompressFile (CCompressionFile &src_file, const string &dst_file, size_t file_io_bufsize=kCompressionDefaultBufSize) |
Universal file decompression function. More... | |
Protected Member Functions inherited from CCompressionProcessor | |
void | Reset (void) |
Reset internal state. More... | |
void | SetBusy (bool busy=true) |
Set/unset compressor busy flag. More... | |
void | IncreaseProcessedSize (size_t n_bytes) |
void | IncreaseOutputSize (size_t n_bytes) |
Private Attributes | |
unsigned long | m_CRC32 |
CRC32 for compressed data. More... | |
string | m_Cache |
Buffer to cache small pieces of data. More... | |
bool | m_NeedWriteHeader |
Is true if needed to write a file header. More... | |
SFileInfo | m_FileInfo |
Compressed file info. More... | |
Additional Inherited Members | |
Public Types inherited from CZipCompression | |
enum | EFlags { fAllowTransparentRead = (1<<0) , fAllowEmptyData = (1<<1) , fCheckFileHeader = (1<<2) , fWriteGZipFormat = (1<<3) , fAllowConcatenatedGZip = (1<<4) , fGZip = fCheckFileHeader | fWriteGZipFormat | fAllowConcatenatedGZip , fRestoreFileAttr = (1<<5) } |
Compression/decompression flags. More... | |
typedef CZipCompression::TFlags | TZipFlags |
Bitwise OR of EFlags. More... | |
Public Types inherited from ICompression | |
enum | ELevel { eLevel_Default = -1 , eLevel_NoCompression = 0 , eLevel_Lowest = 1 , eLevel_VeryLow = 2 , eLevel_Low = 3 , eLevel_MediumLow = 4 , eLevel_Medium = 5 , eLevel_MediumHigh = 6 , eLevel_High = 7 , eLevel_VeryHigh = 8 , eLevel_Best = 9 } |
Compression level. More... | |
enum | ESupportFeature { eFeature_NoCompression , eFeature_Dictionary , eFeature_EstimateCompressionBufferSize } |
Supported features. More... | |
typedef unsigned int | TFlags |
Compression flags. More... | |
Public Types inherited from CCompressionProcessor | |
enum | EStatus { eStatus_Success , eStatus_EndOfData , eStatus_Error , eStatus_Overflow , eStatus_Repeat , eStatus_Unknown } |
Type of the result of all basic functions. More... | |
Static Public Member Functions inherited from CZipCompression | |
static bool | Initialize (void) |
Initialize compression library (for API compatibility, zlib don't need it). More... | |
static SRecommendedBufferSizes | GetRecommendedBufferSizes (size_t round_up=0) |
Get recommended buffer sizes for stream/file I/O. More... | |
static int | GetStrategyDefault (void) |
static int | GetStrategyMin (void) |
static int | GetStrategyMax (void) |
static int | GetMemoryLevelDefault (void) |
static int | GetMemoryLevelMin (void) |
static int | GetMemoryLevelMax (void) |
static int | GetWindowBitsDefault (void) |
static int | GetWindowBitsMin (void) |
static int | GetWindowBitsMax (void) |
Protected Types inherited from CCompression | |
enum | EDecompressMode { eMode_Unknown , eMode_Decompress , eMode_TransparentRead } |
Decompression mode (see fAllowTransparentRead flag). More... | |
Protected Attributes inherited from CZipCompression | |
void * | m_Stream |
Compressor stream. More... | |
int | m_cd_WindowBits |
The base two logarithm of the window size. More... | |
int | m_c_MemLevel |
The allocation memory level for the compression. More... | |
int | m_c_Strategy |
The parameter to tune up a compression algorithm. More... | |
Protected Attributes inherited from CCompression | |
EDecompressMode | m_DecompressMode |
Decompress mode (Decompress/TransparentRead/Unknown) More... | |
CCompressionDictionary * | m_Dict |
Dictionary for compression/decompression. More... | |
ENcbiOwnership | m_DictOwn |
Dictionary ownership. More... | |
CZipCompressor – zlib based compressor.
Used in CZipStreamCompressor.