SECCompressFile Class
class SECCompressFile: public CFile
SECCompressFile is derived from CFile, and provides compression and decompression services for data written to and from the file.
Defined in: seccomp.h
Comments
An instance of SECCompressFile can be in compression mode, where a limited number of CFile access functions are available; and regular mode, where normal CFile behavior is exhibited.
Since SECCompressFile compresses its data as a whole, it is not possible to seek to the middle of a compressed data block to partially decompress a block.
However, by switching back and forth between compressed mode and normal CFile mode, compressed data can be written to a file in different locations, and a jump table might be placed at the beginning of the file to store seek locations of the different compressed blocks.
See the COMPDEMO sample in the \SAMPLES\TOOLKIT\STANDARD\UTILITY\CFILES directory for a demonstration of this class.
Class Members
Creation/Initialization
Constructs a SECCompressFile object.
SECCompressFile( LPCTSTR lpszFileName, UINT nOpenFlags )
Constructs a SECCompressFile object.
SECCompressFile( int hFile )
Constructs a SECCompressFile object.
Operations
virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL, int nCompLevel=-1)
Opens an SECCompressFile with a given pathname.
UINT Read( void FAR *pBuf, UINT nCount )
Reads a number of bytes from the file and decompresses them.
DWORD ReadHuge( void FAR *pBuf, DWORD nCount )
Reads a number of bytes from the file and decompresses them.
void Write( const void FAR *pBuf, UINT nCount )
Compresses and then writes a number of characters to the file.
void WriteHuge( void FAR *pBuf, DWORD nCount )
Compresses and then writes a number of characters to the file.
long Seek( long lOff, UINT nFrom )
Seeks to the specified location.
void SeekToBegin( void )
Seeks to the beginning of file.
void SeekToEnd( void )
Seeks to end of file.
DWORD GetLength()
Returns the compressed length of the file.
void Close( void )
Closes the file.
void SetCompressMode(BOOL bState)
Turns the compression mode on or off.
BOOL GetCompressMode()
Retrieves whether compression is enabled or disabled.
Public data members
SECComp m_Comp
Compression engine object.
gzFile m_gzFile
'zlib' compression object.
BOOL m_bReadHuge
Flag when reading huge vals (WIN3.1 only)
Protected data members
BOOL m_bCompressMode
Indicates whether compression is enabled or disabled.