DWFCompressingInputStream.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 #ifndef _DWFCORE_DWF_COMPRESSING_INPUT_STREAM_H
00023 #define _DWFCORE_DWF_COMPRESSING_INPUT_STREAM_H
00024 
00029 
00030 //
00031 // use either the built-in or sytem zlib header
00032 // depending on the pre-processor configuration
00033 //
00034 #ifndef _ZLIB_H
00035 #ifdef  DWFCORE_BUILD_ZLIB
00036 #include "dwfcore/zlib/zlib.h"
00037 #else
00038 #include <zlib.h>
00039 #endif
00040 #endif
00041 
00042 #include "dwfcore/InputStream.h"
00043 #include "dwfcore/ZipFileDescriptor.h"
00044 
00045 #ifndef DWFCORE_COMPRESSING_INPUT_STREAM_COMPRESSION_BUFFER_SIZE
00055 #define DWFCORE_COMPRESSING_INPUT_STREAM_COMPRESSION_BUFFER_SIZE    16384
00056 #endif
00057 
00058 namespace DWFCore
00059 {
00069 class DWFCompressingInputStream : virtual public DWFCoreMemory
00070                                                                 , public DWFInputStream
00071 {
00072 public:
00085         _DWFCORE_API
00086                 DWFCompressingInputStream( DWFInputStream * pInputStream, DWFZipFileDescriptor::teFileMode fileMode, 
00087                                                            bool bOwnStream )
00088                 
00089                 throw();
00090         
00096         _DWFCORE_API
00097         virtual ~DWFCompressingInputStream()
00098                 throw();
00099         
00112         _DWFCORE_API
00113         size_t available() const
00114                 throw ( DWFException );
00115         
00134         _DWFCORE_API
00135         size_t read ( void * pBuffer, 
00136                                   size_t nBytesToRead )
00137                 throw ( DWFException );
00138         
00147         _DWFCORE_API
00148     off_t seek( int     eOrigin,
00149                 off_t   nOffset )
00150         throw( DWFException );
00151 
00152 private:
00153 
00154         DWFInputStream*                                                 _pInputStream;
00155         bool                                                            _bOwnStream;
00156         z_stream                                                        _oCompressionStream;
00157         bool                                                            _bCompressionStreamInit;
00158         bool                                                            _bCompressionStreamFinished;
00159         
00160         unsigned char*                                                  _pSourceBuffer;
00161         size_t                                                          _nSourceBufferBytes;
00162 
00163         size_t                                                          _nCompressionBytes;
00164         size_t                                                          _nCompressionBufferSize;
00165         size_t                                                          _nCompressionBufferOffset;
00166         size_t                                                          _nCompressedBytesBuffered; 
00167         unsigned char *                                                 _pCompressionBuffer; 
00168         
00169         bool                                                            _bPending;
00170         DWFZipFileDescriptor::teFileMode                                _oFileMode;
00171 private:
00172         //
00173     // Unimplemented methods
00174     //
00175     DWFCompressingInputStream( const DWFCompressingInputStream& );
00176     DWFCompressingInputStream& operator=( const DWFCompressingInputStream& );
00177 };
00178 }
00179 
00180 #endif

Generated on Tue Jan 6 22:39:28 2009 for Autodesk DWF Core Library by  doxygen 1.4.5