1 // ZDecoder.h 2 3 #ifndef ZIP7_INC_COMPRESS_Z_DECODER_H 4 #define ZIP7_INC_COMPRESS_Z_DECODER_H 5 6 #include "../../Common/MyCom.h" 7 8 #include "../ICoder.h" 9 10 namespace NCompress { 11 namespace NZ { 12 13 // Z decoder decodes Z data stream, including 3 bytes of header. 14 15 class CDecoder 16 { 17 UInt16 *_parents; 18 Byte *_suffixes; 19 Byte *_stack; 20 unsigned _numMaxBits; 21 22 public: CDecoder()23 CDecoder(): _parents(NULL), _suffixes(NULL), _stack(NULL), /* _prop(0), */ _numMaxBits(0) {} 24 ~CDecoder(); 25 void Free(); 26 // UInt64 PackSize; 27 28 HRESULT Code(ISequentialInStream *inStream, ISequentialOutStream *outStream, 29 ICompressProgressInfo *progress); 30 }; 31 32 /* 33 There is no end_of_payload_marker in Z stream. 34 Z decoder stops decoding, if it reaches end of input stream. 35 36 CheckStream function: 37 (size) must be at least 3 bytes (size of Z header). 38 if (size) is larger than size of real Z stream in (data), CheckStream can return false. 39 */ 40 41 const unsigned kRecommendedCheckSize = 64; 42 43 bool CheckStream(const Byte *data, size_t size); 44 45 }} 46 47 #endif 48