2 * Copyright 2009,2011, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
5 #ifndef _PACKAGE__HPKG__PACKAGE_READER_H_
6 #define _PACKAGE__HPKG__PACKAGE_READER_H_
9 #include <SupportDefs.h>
15 namespace BPackageKit
{
21 class PackageReaderImpl
;
23 using BPrivate::PackageReaderImpl
;
26 class BAbstractBufferedDataReader
;
28 class BLowLevelPackageContentHandler
;
29 class BPackageContentHandler
;
33 class BPackageReader
{
35 BPackageReader(BErrorOutput
* errorOutput
);
38 status_t
Init(const char* fileName
, uint32 flags
= 0);
39 status_t
Init(int fd
, bool keepFD
, uint32 flags
= 0);
40 status_t
Init(BPositionIO
* file
, bool keepFile
,
42 status_t
ParseContent(
43 BPackageContentHandler
* contentHandler
);
44 status_t
ParseContent(BLowLevelPackageContentHandler
*
47 BPositionIO
* PackageFile() const;
49 BAbstractBufferedDataReader
* HeapReader() const;
50 // Only valid as long as the reader lives.
53 friend class BPackageWriter
;
56 PackageReaderImpl
* fImpl
;
62 } // namespace BPackageKit
65 #endif // _PACKAGE__HPKG__PACKAGE_READER_H_