Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation
ZipArchiveLib::CDeflateCompressor Class Reference

#include <DeflateCompressor.h>

Inheritance diagram for ZipArchiveLib::CDeflateCompressor:
Inheritance graph

Classes

struct  COptions
 

Public Member Functions

bool CanProcess (WORD uMethod)
 
 CDeflateCompressor (CZipStorage *pStorage)
 
void Compress (const void *pBuffer, DWORD uSize)
 
DWORD Decompress (void *pBuffer, DWORD uSize)
 
void FinishCompression (bool bAfterException)
 
void FinishDecompression (bool bAfterException)
 
COffsetsArrayGetOffsetsArray () const
 
const CZipCompressor::COptionsGetOptions () const
 
void InitCompression (int iLevel, CZipFileHeader *pFile, CZipCryptograph *pCryptograph)
 
void InitDecompression (CZipFileHeader *pFile, CZipCryptograph *pCryptograph)
 
- Public Member Functions inherited from ZipArchiveLib::CBaseLibCompressor
 CBaseLibCompressor (CZipStorage *pStorage)
 
void InitDecompression (CZipFileHeader *pFile, CZipCryptograph *pCryptograph)
 
- Public Member Functions inherited from CZipCompressor
bool PrepareForSeek (CZipFileHeader *pCurrentFile, COffsetsPair *pPair)
 
void UpdateOptions (const COptionsMap &optionsMap)
 

Protected Member Functions

int ConvertInternalError (int iErr) const
 
bool IsCodeErrorOK (int iErr) const
 
void UpdateOptions (const CZipCompressor::COptions *pOptions)
 
- Protected Member Functions inherited from ZipArchiveLib::CBaseLibCompressor
void CheckForError (int iErr)
 
void EmptyPtrList ()
 
void SetOpaque (void **opaque, const COptions *pOptions)
 
- Protected Member Functions inherited from CZipCompressor
 CZipCompressor (CZipStorage *pStorage)
 
DWORD FillBuffer ()
 
void FlushWriteBuffer ()
 
void InitBuffer ()
 
void ReleaseBuffer ()
 
void ThrowError (int iErr, bool bInternal=false)
 
void UpdateCrc (const void *pBuffer, DWORD uSize)
 
void UpdateFileCrc (const void *pBuffer, DWORD uSize)
 
void WriteBuffer (char *pBuffer, DWORD uSize)
 

Additional Inherited Members

- Public Types inherited from CZipCompressor
enum  CompressionLevel { levelDefault = -1, levelStore = 0, levelFastest = 1, levelBest = 9 }
 
enum  CompressionMethod { methodStore = 0, methodDeflate = 8, methodBzip2 = 12, methodWinZipAes = 99 }
 
enum  CompressorType { typeDeflate = 1, typeBzip2, typePPMd }
 
typedef CZipArray< COffsetsPair * > CZipOffsetsPairsArray
 
- Static Public Member Functions inherited from CZipCompressor
static CZipCompressorCreateCompressor (WORD uMethod, CZipStorage *pStorage)
 
static bool IsCompressionSupported (WORD uCompressionMethod)
 
- Public Attributes inherited from CZipCompressor
ZIP_SIZE_TYPE m_uComprLeft
 The number of bytes left to compress.
 
DWORD m_uCrc32
 The CRC32 file checksum.
 
ZIP_SIZE_TYPE m_uUncomprLeft
 The number of bytes left to decompress.
 
- Static Protected Member Functions inherited from ZipArchiveLib::CBaseLibCompressor
static void * _zipalloc (void *opaque, UINT items, UINT size)
 
static void _zipfree (void *opaque, void *address)
 
- Protected Attributes inherited from ZipArchiveLib::CBaseLibCompressor
bool m_bDecompressionDone
 

Detailed Description

Compresses and decompresses data using the Zlib library.

Constructor & Destructor Documentation

ZipArchiveLib::CDeflateCompressor::CDeflateCompressor ( CZipStorage pStorage)

Initializes a new instance of the CDeflateCompressor class.

Parameters
pStorageThe current storage object.

Member Function Documentation

bool ZipArchiveLib::CDeflateCompressor::CanProcess ( WORD  uMethod)
inlinevirtual

Returns the value indicating whether the current CZipCompressor object supports the given compression method.

Parameters
uMethodThe compression method. It can be one of the CompressionMethod values.
Returns
true, if the compression method is supported; false otherwise.

Implements CZipCompressor.

void ZipArchiveLib::CDeflateCompressor::Compress ( const void *  pBuffer,
DWORD  uSize 
)
virtual

Compresses the given data.

Parameters
pBufferThe buffer that holds the data to compress.
uSizeThe size of pBuffer.
See Also
InitCompression
FinishCompression

Implements CZipCompressor.

int ZipArchiveLib::CDeflateCompressor::ConvertInternalError ( int  iErr) const
inlineprotectedvirtual

Converts an internal error code of the compressor to the ZipArchive Library error code.

Parameters
iErrAn internal error code.
Returns
A ZipArchive Library error code.

Reimplemented from CZipCompressor.

DWORD ZipArchiveLib::CDeflateCompressor::Decompress ( void *  pBuffer,
DWORD  uSize 
)
virtual

Decompresses the given data.

Parameters
pBufferThe buffer that receives the decompressed data.
uSizeThe size of pBuffer.
Returns
The number of bytes decompressed and written to pBuffer.
Note
This method should be called repeatedly until it returns 0.
See Also
InitDecompression
FinishDecompression

Implements CZipCompressor.

void ZipArchiveLib::CDeflateCompressor::FinishCompression ( bool  bAfterException)
virtual

The method called at the end of the compression process.

Parameters
bAfterExceptionSet to true, if an exception occurred before or to false otherwise.
See Also
InitCompression
Compress

Reimplemented from CZipCompressor.

void ZipArchiveLib::CDeflateCompressor::FinishDecompression ( bool  bAfterException)
virtual

The method called at the end of the decompression process.

Parameters
bAfterExceptionSet to true, if an exception occurred before or to false otherwise.
See Also
InitDecompression
Decompress

Reimplemented from CZipCompressor.

COffsetsArray* ZipArchiveLib::CDeflateCompressor::GetOffsetsArray ( ) const
inline

Retrieves the offsets array that gives the location of the synchronization blocks. This method should be called just after compressing a file. The array pointer will be invalid with the next compression operation or when a file is decompressed with a method different than the deflate method or when an archive is closed. You can save the array to a buffer with the CZipCompressor::COffsetsArray::Save method.

Returns
The offsets array created for the recently compressed file.
See Also
Creating Seekable Compressed Data
CZipCompressor::COffsetsArray
COptions::m_iSyncRatio
COptions::m_bCreateOffsetsArray
const CZipCompressor::COptions* ZipArchiveLib::CDeflateCompressor::GetOptions ( ) const
inlinevirtual

Returns the current options of the compressor.

Returns
The current options for the compressor.
See Also
Compressing Data
CZipArchive::SetCompressionOptions
UpdateOptions

Reimplemented from CZipCompressor.

void ZipArchiveLib::CDeflateCompressor::InitCompression ( int  iLevel,
CZipFileHeader pFile,
CZipCryptograph pCryptograph 
)
virtual

The method called when a new file is opened for compression.

Parameters
iLevelThe compression level.
pFileThe file being compressed.
pCryptographThe current CZipCryptograph. It can be NULL, if no encryption is used.
See Also
Compress
FinishCompression

Reimplemented from CZipCompressor.

void ZipArchiveLib::CDeflateCompressor::InitDecompression ( CZipFileHeader pFile,
CZipCryptograph pCryptograph 
)
virtual

The method called when a new file is opened for extraction.

Parameters
pFileThe file being extracted.
pCryptographThe current CZipCryptograph. It can be NULL, if no decryption is used.
See Also
Decompress
FinishDecompression

Reimplemented from CZipCompressor.

bool ZipArchiveLib::CDeflateCompressor::IsCodeErrorOK ( int  iErr) const
inlineprotectedvirtual

Checks whether iErr value is an error code.

Parameters
iErrThe code to check.
Returns
true, if iErr is an error code; false otherwise.

Implements ZipArchiveLib::CBaseLibCompressor.

void ZipArchiveLib::CDeflateCompressor::UpdateOptions ( const CZipCompressor::COptions pOptions)
inlineprotectedvirtual

Updates the current options with the new options.

Parameters
pOptionsThe new options to apply.

Reimplemented from CZipCompressor.


The documentation for this class was generated from the following file:
Back To Top Up