3 #ifndef __OUTBUFFER_H
\r
4 #define __OUTBUFFER_H
\r
6 #include "../IStream.h"
\r
7 #include "../../Common/MyCom.h"
\r
8 #include "../../Common/MyException.h"
\r
10 #ifndef _NO_EXCEPTIONS
\r
11 struct COutBufferException: public CSystemException
\r
13 COutBufferException(HRESULT errorCode): CSystemException(errorCode) {}
\r
25 CMyComPtr<ISequentialOutStream> _stream;
\r
26 UInt64 _processedSize;
\r
30 HRESULT FlushPart();
\r
32 #ifdef _NO_EXCEPTIONS
\r
36 COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}
\r
37 ~COutBuffer() { Free(); }
\r
39 bool Create(UInt32 bufferSize);
\r
42 void SetMemStream(Byte *buffer) { _buffer2 = buffer; }
\r
43 void SetStream(ISequentialOutStream *stream);
\r
46 void FlushWithCheck();
\r
47 void ReleaseStream() { _stream.Release(); }
\r
49 void WriteByte(Byte b)
\r
51 _buffer[_pos++] = b;
\r
52 if(_pos == _limitPos)
\r
55 void WriteBytes(const void *data, size_t size)
\r
57 for (size_t i = 0; i < size; i++)
\r
58 WriteByte(((const Byte *)data)[i]);
\r
61 UInt64 GetProcessedSize() const;
\r