haiku/headers/private/package/hpkg/PackageFileHeapReader.h
Ingo Weinhold e527b79631 Switch package file accessor classes to use BPositionIO
* PackageFileHeap{Reader,Writer} as well as Package{Reader,Writer} and
  their implementation and super classes do now internally use a
  BPositionIO instead of a FD to access the package file. This provides
  more flexibility needed for features to come.
* BPackageReader has already grown a new Init() version with a
  BPositionIO* parameter.
2014-07-12 15:40:22 +02:00

60 lines
1.2 KiB
C++

/*
* Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_READER_H_
#define _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_READER_H_
#include <Array.h>
#include <package/hpkg/PackageFileHeapAccessorBase.h>
namespace BPackageKit {
namespace BHPKG {
class BDataReader;
class BErrorOutput;
namespace BPrivate {
class PackageFileHeapReader : public PackageFileHeapAccessorBase {
public:
PackageFileHeapReader(BErrorOutput* errorOutput,
BPositionIO* file, off_t heapOffset,
off_t compressedHeapSize,
uint64 uncompressedHeapSize,
DecompressionAlgorithmOwner*
decompressionAlgorithm);
~PackageFileHeapReader();
status_t Init();
PackageFileHeapReader* Clone() const;
const OffsetArray& Offsets() const
{ return fOffsets; }
protected:
virtual status_t ReadAndDecompressChunk(size_t chunkIndex,
void* compressedDataBuffer,
void* uncompressedDataBuffer);
private:
OffsetArray fOffsets;
};
} // namespace BPrivate
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__PRIVATE__PACKAGE_FILE_HEAP_READER_H_