6 #include "../IStream.h"
\r
7 #include "../../Common/MyCom.h"
\r
9 #ifndef _NO_EXCEPTIONS
\r
10 class CInBufferException
\r
14 CInBufferException(HRESULT errorCode): ErrorCode(errorCode) {}
\r
23 CMyComPtr<ISequentialInStream> _stream;
\r
24 UInt64 _processedSize;
\r
32 #ifdef _NO_EXCEPTIONS
\r
37 ~CInBuffer() { Free(); }
\r
39 bool Create(UInt32 bufferSize);
\r
42 void SetStream(ISequentialInStream *stream);
\r
44 void ReleaseStream() { _stream.Release(); }
\r
46 bool ReadByte(Byte &b)
\r
48 if(_buffer >= _bufferLimit)
\r
56 if(_buffer >= _bufferLimit)
\r
57 return ReadBlock2();
\r
60 void ReadBytes(void *data, UInt32 size, UInt32 &processedSize)
\r
62 for(processedSize = 0; processedSize < size; processedSize++)
\r
63 if (!ReadByte(((Byte *)data)[processedSize]))
\r
66 bool ReadBytes(void *data, UInt32 size)
\r
68 UInt32 processedSize;
\r
69 ReadBytes(data, size, processedSize);
\r
70 return (processedSize == size);
\r
72 UInt64 GetProcessedSize() const { return _processedSize + (_buffer - _bufferBase); }
\r
73 bool WasFinished() const { return _wasFinished; }
\r