xref: /haiku/headers/private/package/hpkg/PackageFileHeapReader.h (revision b617a7b410c05275effb95f4b2f5608359d9b7b9)
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 									int fd, off_t heapOffset,
29 									off_t compressedHeapSize,
30 									uint64 uncompressedHeapSize);
31 								~PackageFileHeapReader();
32 
33 			status_t			Init();
34 
35 			PackageFileHeapReader* Clone() const;
36 
37 			const OffsetArray&	Offsets() const
38 									{ return fOffsets; }
39 
40 protected:
41 	virtual	status_t			ReadAndDecompressChunk(size_t chunkIndex,
42 									void* compressedDataBuffer,
43 									void* uncompressedDataBuffer);
44 
45 private:
46 			OffsetArray			fOffsets;
47 };
48 
49 
50 }	// namespace BPrivate
51 
52 }	// namespace BHPKG
53 
54 }	// namespace BPackageKit
55 
56 
57 #endif	// _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_READER_H_
58