3 #ifndef __OUTSTREAMWITHCRC_H
4 #define __OUTSTREAMWITHCRC_H
6 #include "../../../Common/MyCom.h"
7 #include "../../IStream.h"
11 #include "../../../../C/7zCrc.h"
14 class COutStreamWithCRC:
15 public ISequentialOutStream,
18 CMyComPtr<ISequentialOutStream> _stream;
24 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
25 void SetStream(ISequentialOutStream *stream) { _stream = stream; }
26 void ReleaseStream() { _stream.Release(); }
27 void Init(bool calculate = true)
30 _calculate = calculate;
33 void InitCRC() { _crc = CRC_INIT_VAL; }
34 UInt64 GetSize() const { return _size; }
35 UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); }