1 /* 2 * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_READER_H_ 6 #define _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_READER_H_ 7 8 9 #include <Array.h> 10 #include <package/hpkg/PackageFileHeapAccessorBase.h> 11 12 13 namespace BPackageKit { 14 15 namespace BHPKG { 16 17 18 class BDataReader; 19 class BErrorOutput; 20 21 22 namespace BPrivate { 23 24 25 class PackageFileHeapReader : public PackageFileHeapAccessorBase { 26 public: 27 PackageFileHeapReader(BErrorOutput* errorOutput, 28 BPositionIO* file, off_t heapOffset, 29 off_t compressedHeapSize, 30 uint64 uncompressedHeapSize, 31 DecompressionAlgorithmOwner* 32 decompressionAlgorithm); 33 ~PackageFileHeapReader(); 34 35 status_t Init(); 36 37 PackageFileHeapReader* Clone() const; 38 39 const OffsetArray& Offsets() const 40 { return fOffsets; } 41 42 protected: 43 virtual status_t ReadAndDecompressChunk(size_t chunkIndex, 44 void* compressedDataBuffer, 45 void* uncompressedDataBuffer); 46 47 private: 48 OffsetArray fOffsets; 49 }; 50 51 52 } // namespace BPrivate 53 54 } // namespace BHPKG 55 56 } // namespace BPackageKit 57 58 59 #endif // _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_READER_H_ 60