1370b324cSopenharmony_ci// StreamUtils.h 2370b324cSopenharmony_ci 3370b324cSopenharmony_ci#ifndef ZIP7_INC_STREAM_UTILS_H 4370b324cSopenharmony_ci#define ZIP7_INC_STREAM_UTILS_H 5370b324cSopenharmony_ci 6370b324cSopenharmony_ci#include "../IStream.h" 7370b324cSopenharmony_ci 8370b324cSopenharmony_ciinline HRESULT InStream_SeekSet(IInStream *stream, UInt64 offset) throw() 9370b324cSopenharmony_ci { return stream->Seek((Int64)offset, STREAM_SEEK_SET, NULL); } 10370b324cSopenharmony_ciinline HRESULT InStream_GetPos(IInStream *stream, UInt64 &curPosRes) throw() 11370b324cSopenharmony_ci { return stream->Seek(0, STREAM_SEEK_CUR, &curPosRes); } 12370b324cSopenharmony_ciinline HRESULT InStream_GetSize_SeekToEnd(IInStream *stream, UInt64 &sizeRes) throw() 13370b324cSopenharmony_ci { return stream->Seek(0, STREAM_SEEK_END, &sizeRes); } 14370b324cSopenharmony_ci 15370b324cSopenharmony_ciHRESULT InStream_SeekToBegin(IInStream *stream) throw(); 16370b324cSopenharmony_ciHRESULT InStream_AtBegin_GetSize(IInStream *stream, UInt64 &size) throw(); 17370b324cSopenharmony_ciHRESULT InStream_GetPos_GetSize(IInStream *stream, UInt64 &curPosRes, UInt64 &sizeRes) throw(); 18370b324cSopenharmony_ci 19370b324cSopenharmony_ciinline HRESULT InStream_GetSize_SeekToBegin(IInStream *stream, UInt64 &sizeRes) throw() 20370b324cSopenharmony_ci{ 21370b324cSopenharmony_ci RINOK(InStream_SeekToBegin(stream)) 22370b324cSopenharmony_ci return InStream_AtBegin_GetSize(stream, sizeRes); 23370b324cSopenharmony_ci} 24370b324cSopenharmony_ci 25370b324cSopenharmony_ci 26370b324cSopenharmony_ciHRESULT ReadStream(ISequentialInStream *stream, void *data, size_t *size) throw(); 27370b324cSopenharmony_ciHRESULT ReadStream_FALSE(ISequentialInStream *stream, void *data, size_t size) throw(); 28370b324cSopenharmony_ciHRESULT ReadStream_FAIL(ISequentialInStream *stream, void *data, size_t size) throw(); 29370b324cSopenharmony_ciHRESULT WriteStream(ISequentialOutStream *stream, const void *data, size_t size) throw(); 30370b324cSopenharmony_ci 31370b324cSopenharmony_ci#endif 32