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