14514f5e3Sopenharmony_ci/* 24514f5e3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License. 54514f5e3Sopenharmony_ci * You may obtain a copy of the License at 64514f5e3Sopenharmony_ci * 74514f5e3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 84514f5e3Sopenharmony_ci * 94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and 134514f5e3Sopenharmony_ci * limitations under the License. 144514f5e3Sopenharmony_ci */ 154514f5e3Sopenharmony_ci 164514f5e3Sopenharmony_ci#ifndef OHOS_ABILITY_BASE_ZIP_FILE_H 174514f5e3Sopenharmony_ci#define OHOS_ABILITY_BASE_ZIP_FILE_H 184514f5e3Sopenharmony_ci 194514f5e3Sopenharmony_ci#include <memory> 204514f5e3Sopenharmony_ci#include <set> 214514f5e3Sopenharmony_ci#include <string> 224514f5e3Sopenharmony_ci#include <unordered_map> 234514f5e3Sopenharmony_ci#include <vector> 244514f5e3Sopenharmony_ci 254514f5e3Sopenharmony_ci#include "file_mapper.h" 264514f5e3Sopenharmony_ci#include <contrib/minizip/unzip.h> 274514f5e3Sopenharmony_ci 284514f5e3Sopenharmony_cinamespace panda { 294514f5e3Sopenharmony_cinamespace ecmascript { 304514f5e3Sopenharmony_ciclass ZipFileReader; 314514f5e3Sopenharmony_cistruct CentralDirEntry; 324514f5e3Sopenharmony_cistruct ZipEntry; 334514f5e3Sopenharmony_ciusing ZipPos = ZPOS64_T; 344514f5e3Sopenharmony_ciusing ZipEntryMap = std::unordered_map<std::string, ZipEntry>; 354514f5e3Sopenharmony_ciusing BytePtr = Byte *; 364514f5e3Sopenharmony_ci 374514f5e3Sopenharmony_ci// Local file header: descript in APPNOTE-6.3.4 384514f5e3Sopenharmony_ci// local file header signature 4 bytes (0x04034b50) 394514f5e3Sopenharmony_ci// version needed to extract 2 bytes 404514f5e3Sopenharmony_ci// general purpose bit flag 2 bytes 414514f5e3Sopenharmony_ci// compression method 2 bytes 10 424514f5e3Sopenharmony_ci// last mod file time 2 bytes 434514f5e3Sopenharmony_ci// last mod file date 2 bytes 444514f5e3Sopenharmony_ci// crc-32 4 bytes 454514f5e3Sopenharmony_ci// compressed size 4 bytes 22 464514f5e3Sopenharmony_ci// uncompressed size 4 bytes 474514f5e3Sopenharmony_ci// file name length 2 bytes 484514f5e3Sopenharmony_ci// extra field length 2 bytes 30 494514f5e3Sopenharmony_cistruct __attribute__((packed)) LocalHeader { 504514f5e3Sopenharmony_ci uint32_t signature = 0; 514514f5e3Sopenharmony_ci uint16_t versionNeeded = 0; 524514f5e3Sopenharmony_ci uint16_t flags = 0; 534514f5e3Sopenharmony_ci uint16_t compressionMethod = 0; 544514f5e3Sopenharmony_ci uint16_t modifiedTime = 0; 554514f5e3Sopenharmony_ci uint16_t modifiedDate = 0; 564514f5e3Sopenharmony_ci uint32_t crc = 0; 574514f5e3Sopenharmony_ci uint32_t compressedSize = 0; 584514f5e3Sopenharmony_ci uint32_t uncompressedSize = 0; 594514f5e3Sopenharmony_ci uint16_t nameSize = 0; 604514f5e3Sopenharmony_ci uint16_t extraSize = 0; 614514f5e3Sopenharmony_ci}; 624514f5e3Sopenharmony_ci 634514f5e3Sopenharmony_ci// central file header 644514f5e3Sopenharmony_ci// Central File header: 654514f5e3Sopenharmony_ci// central file header signature 4 bytes (0x02014b50) 664514f5e3Sopenharmony_ci// version made by 2 bytes 674514f5e3Sopenharmony_ci// version needed to extract 2 bytes 684514f5e3Sopenharmony_ci// general purpose bit flag 2 bytes 10 694514f5e3Sopenharmony_ci// compression method 2 bytes 704514f5e3Sopenharmony_ci// last mod file time 2 bytes 714514f5e3Sopenharmony_ci// last mod file date 2 bytes 724514f5e3Sopenharmony_ci// crc-32 4 bytes 20 734514f5e3Sopenharmony_ci// compressed size 4 bytes 744514f5e3Sopenharmony_ci// uncompressed size 4 bytes 754514f5e3Sopenharmony_ci// file name length 2 bytes 30 764514f5e3Sopenharmony_ci// extra field length 2 bytes 774514f5e3Sopenharmony_ci// file comment length 2 bytes 784514f5e3Sopenharmony_ci// disk number start 2 bytes 794514f5e3Sopenharmony_ci// internal file attributes 2 bytes 804514f5e3Sopenharmony_ci// external file attributes 4 bytes 814514f5e3Sopenharmony_ci// relative offset of local header 4 bytes 46byte 824514f5e3Sopenharmony_cistruct __attribute__((packed)) CentralDirEntry { 834514f5e3Sopenharmony_ci uint32_t signature = 0; 844514f5e3Sopenharmony_ci uint16_t versionMade = 0; 854514f5e3Sopenharmony_ci uint16_t versionNeeded = 0; 864514f5e3Sopenharmony_ci uint16_t flags = 0; // general purpose bit flag 874514f5e3Sopenharmony_ci uint16_t compressionMethod = 0; 884514f5e3Sopenharmony_ci uint16_t modifiedTime = 0; 894514f5e3Sopenharmony_ci uint16_t modifiedDate = 0; 904514f5e3Sopenharmony_ci uint32_t crc = 0; 914514f5e3Sopenharmony_ci uint32_t compressedSize = 0; 924514f5e3Sopenharmony_ci uint32_t uncompressedSize = 0; 934514f5e3Sopenharmony_ci uint16_t nameSize = 0; 944514f5e3Sopenharmony_ci uint16_t extraSize = 0; 954514f5e3Sopenharmony_ci uint16_t commentSize = 0; 964514f5e3Sopenharmony_ci uint16_t diskNumStart = 0; 974514f5e3Sopenharmony_ci uint16_t internalAttr = 0; 984514f5e3Sopenharmony_ci uint32_t externalAttr = 0; 994514f5e3Sopenharmony_ci uint32_t localHeaderOffset = 0; 1004514f5e3Sopenharmony_ci}; 1014514f5e3Sopenharmony_ci 1024514f5e3Sopenharmony_ci// end of central directory packed structure 1034514f5e3Sopenharmony_ci// end of central dir signature 4 bytes (0x06054b50) 1044514f5e3Sopenharmony_ci// number of this disk 2 bytes 1054514f5e3Sopenharmony_ci// number of the disk with the 1064514f5e3Sopenharmony_ci// start of the central directory 2 bytes 1074514f5e3Sopenharmony_ci// total number of entries in the 1084514f5e3Sopenharmony_ci// central directory on this disk 2 bytes 1094514f5e3Sopenharmony_ci// total number of entries in 1104514f5e3Sopenharmony_ci// the central directory 2 bytes 1114514f5e3Sopenharmony_ci// size of the central directory 4 bytes 1124514f5e3Sopenharmony_ci// offset of start of central 1134514f5e3Sopenharmony_ci// directory with respect to 1144514f5e3Sopenharmony_ci// the starting disk number 4 bytes 1154514f5e3Sopenharmony_ci// .ZIP file comment length 2 bytes 1164514f5e3Sopenharmony_cistruct __attribute__((packed)) EndDir { 1174514f5e3Sopenharmony_ci uint32_t signature = 0; 1184514f5e3Sopenharmony_ci uint16_t numDisk = 0; 1194514f5e3Sopenharmony_ci uint16_t startDiskOfCentralDir = 0; 1204514f5e3Sopenharmony_ci uint16_t totalEntriesInThisDisk = 0; 1214514f5e3Sopenharmony_ci uint16_t totalEntries = 0; 1224514f5e3Sopenharmony_ci uint32_t sizeOfCentralDir = 0; 1234514f5e3Sopenharmony_ci uint32_t offset = 0; 1244514f5e3Sopenharmony_ci uint16_t commentLen = 0; 1254514f5e3Sopenharmony_ci}; 1264514f5e3Sopenharmony_ci 1274514f5e3Sopenharmony_ci// Data descriptor: 1284514f5e3Sopenharmony_ci// data descriptor signature 4 bytes (0x06054b50) 1294514f5e3Sopenharmony_ci// crc-32 4 bytes 1304514f5e3Sopenharmony_ci// compressed size 4 bytes 1314514f5e3Sopenharmony_ci// uncompressed size 4 bytes 1324514f5e3Sopenharmony_ci// This descriptor MUST exist if bit 3 of the general purpose bit flag is set (see below). 1334514f5e3Sopenharmony_ci// It is byte aligned and immediately follows the last byte of compressed data. 1344514f5e3Sopenharmony_cistruct __attribute__((packed)) DataDesc { 1354514f5e3Sopenharmony_ci uint32_t signature = 0; 1364514f5e3Sopenharmony_ci uint32_t crc = 0; 1374514f5e3Sopenharmony_ci uint32_t compressedSize = 0; 1384514f5e3Sopenharmony_ci uint32_t uncompressedSize = 0; 1394514f5e3Sopenharmony_ci}; 1404514f5e3Sopenharmony_ci 1414514f5e3Sopenharmony_cistruct ZipEntry { 1424514f5e3Sopenharmony_ci ZipEntry() = default; 1434514f5e3Sopenharmony_ci explicit ZipEntry(const CentralDirEntry ¢ralEntry); 1444514f5e3Sopenharmony_ci ~ZipEntry() = default; // for CodeDEX warning 1454514f5e3Sopenharmony_ci 1464514f5e3Sopenharmony_ci uint16_t compressionMethod = 0; 1474514f5e3Sopenharmony_ci uint32_t uncompressedSize = 0; 1484514f5e3Sopenharmony_ci uint32_t compressedSize = 0; 1494514f5e3Sopenharmony_ci uint32_t localHeaderOffset = 0; 1504514f5e3Sopenharmony_ci uint32_t crc = 0; 1514514f5e3Sopenharmony_ci uint16_t flags = 0; 1524514f5e3Sopenharmony_ci uint16_t modifiedTime = 0; 1534514f5e3Sopenharmony_ci uint16_t modifiedDate = 0; 1544514f5e3Sopenharmony_ci std::string fileName; 1554514f5e3Sopenharmony_ci}; 1564514f5e3Sopenharmony_ci 1574514f5e3Sopenharmony_cistruct DirTreeNode { 1584514f5e3Sopenharmony_ci std::unordered_map<std::string, std::shared_ptr<DirTreeNode>> children; 1594514f5e3Sopenharmony_ci}; 1604514f5e3Sopenharmony_ci 1614514f5e3Sopenharmony_ci// zip file extract class for bundle format. 1624514f5e3Sopenharmony_ciclass ZipFile { 1634514f5e3Sopenharmony_cipublic: 1644514f5e3Sopenharmony_ci explicit ZipFile(const std::string &pathName); 1654514f5e3Sopenharmony_ci ~ZipFile(); 1664514f5e3Sopenharmony_ci /** 1674514f5e3Sopenharmony_ci * @brief Open zip file. 1684514f5e3Sopenharmony_ci * @return Returns true if the zip file is successfully opened; returns false otherwise. 1694514f5e3Sopenharmony_ci */ 1704514f5e3Sopenharmony_ci bool Open(); 1714514f5e3Sopenharmony_ci /** 1724514f5e3Sopenharmony_ci * @brief Close zip file. 1734514f5e3Sopenharmony_ci */ 1744514f5e3Sopenharmony_ci void Close(); 1754514f5e3Sopenharmony_ci /** 1764514f5e3Sopenharmony_ci * @brief Set this zip content start offset and length in the zip file form pathName. 1774514f5e3Sopenharmony_ci * @param start Indicates the zip content location start position. 1784514f5e3Sopenharmony_ci * @param length Indicates the zip content length. 1794514f5e3Sopenharmony_ci */ 1804514f5e3Sopenharmony_ci void SetContentLocation(const ZipPos start, const size_t length); 1814514f5e3Sopenharmony_ci /** 1824514f5e3Sopenharmony_ci * @brief Get all entries in the zip file. 1834514f5e3Sopenharmony_ci * @param start Indicates the zip content location start position. 1844514f5e3Sopenharmony_ci * @param length Indicates the zip content length. 1854514f5e3Sopenharmony_ci * @return Returns the ZipEntryMap object cotain all entries. 1864514f5e3Sopenharmony_ci */ 1874514f5e3Sopenharmony_ci const ZipEntryMap &GetAllEntries() const; 1884514f5e3Sopenharmony_ci /** 1894514f5e3Sopenharmony_ci * @brief Has entry by name. 1904514f5e3Sopenharmony_ci * @param entryName Indicates the entry name. 1914514f5e3Sopenharmony_ci * @return Returns true if the ZipEntry is successfully finded; returns false otherwise. 1924514f5e3Sopenharmony_ci */ 1934514f5e3Sopenharmony_ci bool HasEntry(const std::string &entryName) const; 1944514f5e3Sopenharmony_ci 1954514f5e3Sopenharmony_ci bool IsDirExist(const std::string &dir) const; 1964514f5e3Sopenharmony_ci void GetAllFileList(const std::string &srcPath, std::vector<std::string> &assetList); 1974514f5e3Sopenharmony_ci void GetChildNames(const std::string &srcPath, std::set<std::string> &fileSet); 1984514f5e3Sopenharmony_ci 1994514f5e3Sopenharmony_ci /** 2004514f5e3Sopenharmony_ci * @brief Get entry by name. 2014514f5e3Sopenharmony_ci * @param entryName Indicates the entry name. 2024514f5e3Sopenharmony_ci * @param resultEntry Indicates the obtained ZipEntry object. 2034514f5e3Sopenharmony_ci * @return Returns true if the ZipEntry is successfully finded; returns false otherwise. 2044514f5e3Sopenharmony_ci */ 2054514f5e3Sopenharmony_ci bool GetEntry(const std::string &entryName, ZipEntry &resultEntry) const; 2064514f5e3Sopenharmony_ci /** 2074514f5e3Sopenharmony_ci * @brief Get data relative offset for file. 2084514f5e3Sopenharmony_ci * @param file Indicates the entry name. 2094514f5e3Sopenharmony_ci * @param offset Indicates the obtained offset. 2104514f5e3Sopenharmony_ci * @param length Indicates the length. 2114514f5e3Sopenharmony_ci * @return Returns true if this function is successfully called; returns false otherwise. 2124514f5e3Sopenharmony_ci */ 2134514f5e3Sopenharmony_ci bool GetDataOffsetRelative(const std::string &file, ZipPos &offset, uint32_t &length) const; 2144514f5e3Sopenharmony_ci /** 2154514f5e3Sopenharmony_ci * @brief Get data relative offset for file. 2164514f5e3Sopenharmony_ci * @param file Indicates the entry name. 2174514f5e3Sopenharmony_ci * @param dest Indicates the obtained ostream object. 2184514f5e3Sopenharmony_ci * @return Returns true if file is successfully extracted; returns false otherwise. 2194514f5e3Sopenharmony_ci */ 2204514f5e3Sopenharmony_ci bool ExtractFile(const std::string &file, std::ostream &dest) const; 2214514f5e3Sopenharmony_ci 2224514f5e3Sopenharmony_ci std::unique_ptr<FileMapper> CreateFileMapper(const std::string &fileName, FileMapperType type) const; 2234514f5e3Sopenharmony_ci bool ExtractToBufByName(const std::string &fileName, std::unique_ptr<uint8_t[]> &dataPtr, 2244514f5e3Sopenharmony_ci size_t &len) const; 2254514f5e3Sopenharmony_ci friend class ZipFileFriend; 2264514f5e3Sopenharmony_ciprivate: 2274514f5e3Sopenharmony_ci bool GetDataOffsetRelative(const ZipEntry &zipEntry, ZipPos &offset, uint32_t &length) const; 2284514f5e3Sopenharmony_ci /** 2294514f5e3Sopenharmony_ci * @brief Check the EndDir object. 2304514f5e3Sopenharmony_ci * @param endDir Indicates the EndDir object to check. 2314514f5e3Sopenharmony_ci * @return Returns true if successfully checked; returns false otherwise. 2324514f5e3Sopenharmony_ci */ 2334514f5e3Sopenharmony_ci bool CheckEndDir(const EndDir &endDir) const; 2344514f5e3Sopenharmony_ci /** 2354514f5e3Sopenharmony_ci * @brief Parse the EndDir. 2364514f5e3Sopenharmony_ci * @return Returns true if successfully Parsed; returns false otherwise. 2374514f5e3Sopenharmony_ci */ 2384514f5e3Sopenharmony_ci bool ParseEndDirectory(); 2394514f5e3Sopenharmony_ci /** 2404514f5e3Sopenharmony_ci * @brief Parse one entry. 2414514f5e3Sopenharmony_ci * @return Returns true if successfully parsed; returns false otherwise. 2424514f5e3Sopenharmony_ci */ 2434514f5e3Sopenharmony_ci bool ParseOneEntry(uint8_t* &entryPtr); 2444514f5e3Sopenharmony_ci void AddEntryToTree(const std::string &fileName); 2454514f5e3Sopenharmony_ci /** 2464514f5e3Sopenharmony_ci * @brief Parse all Entries. 2474514f5e3Sopenharmony_ci * @return Returns true if successfully parsed; returns false otherwise. 2484514f5e3Sopenharmony_ci */ 2494514f5e3Sopenharmony_ci bool ParseAllEntries(); 2504514f5e3Sopenharmony_ci /** 2514514f5e3Sopenharmony_ci * @brief Get LocalHeader object size. 2524514f5e3Sopenharmony_ci * @param nameSize Indicates the nameSize. 2534514f5e3Sopenharmony_ci * @param extraSize Indicates the extraSize. 2544514f5e3Sopenharmony_ci * @return Returns size of LocalHeader. 2554514f5e3Sopenharmony_ci */ 2564514f5e3Sopenharmony_ci size_t GetLocalHeaderSize(const uint16_t nameSize = 0, const uint16_t extraSize = 0) const; 2574514f5e3Sopenharmony_ci /** 2584514f5e3Sopenharmony_ci * @brief Get entry data offset. 2594514f5e3Sopenharmony_ci * @param zipEntry Indicates the ZipEntry object. 2604514f5e3Sopenharmony_ci * @param extraSize Indicates the extraSize. 2614514f5e3Sopenharmony_ci * @return Returns position. 2624514f5e3Sopenharmony_ci */ 2634514f5e3Sopenharmony_ci ZipPos GetEntryDataOffset(const ZipEntry &zipEntry, const uint16_t extraSize) const; 2644514f5e3Sopenharmony_ci /** 2654514f5e3Sopenharmony_ci * @brief Check data description. 2664514f5e3Sopenharmony_ci * @param zipEntry Indicates the ZipEntry object. 2674514f5e3Sopenharmony_ci * @param localHeader Indicates the localHeader object. 2684514f5e3Sopenharmony_ci * @return Returns true if successfully checked; returns false otherwise. 2694514f5e3Sopenharmony_ci */ 2704514f5e3Sopenharmony_ci bool CheckDataDesc(const ZipEntry &zipEntry, const LocalHeader &localHeader) const; 2714514f5e3Sopenharmony_ci /** 2724514f5e3Sopenharmony_ci * @brief Check coherency LocalHeader object. 2734514f5e3Sopenharmony_ci * @param zipEntry Indicates the ZipEntry object. 2744514f5e3Sopenharmony_ci * @param extraSize Indicates the obtained size. 2754514f5e3Sopenharmony_ci * @return Returns true if successfully checked; returns false otherwise. 2764514f5e3Sopenharmony_ci */ 2774514f5e3Sopenharmony_ci bool CheckCoherencyLocalHeader(const ZipEntry &zipEntry, uint16_t &extraSize) const; 2784514f5e3Sopenharmony_ci /** 2794514f5e3Sopenharmony_ci * @brief Unzip ZipEntry object to ostream. 2804514f5e3Sopenharmony_ci * @param zipEntry Indicates the ZipEntry object. 2814514f5e3Sopenharmony_ci * @param extraSize Indicates the size. 2824514f5e3Sopenharmony_ci * @param dest Indicates the obtained ostream object. 2834514f5e3Sopenharmony_ci * @return Returns true if successfully Unzip; returns false otherwise. 2844514f5e3Sopenharmony_ci */ 2854514f5e3Sopenharmony_ci bool UnzipWithStore(const ZipEntry &zipEntry, const uint16_t extraSize, std::ostream &dest) const; 2864514f5e3Sopenharmony_ci /** 2874514f5e3Sopenharmony_ci * @brief Unzip ZipEntry object to ostream. 2884514f5e3Sopenharmony_ci * @param zipEntry Indicates the ZipEntry object. 2894514f5e3Sopenharmony_ci * @param extraSize Indicates the size. 2904514f5e3Sopenharmony_ci * @param dest Indicates the obtained ostream object. 2914514f5e3Sopenharmony_ci * @return Returns true if successfully Unzip; returns false otherwise. 2924514f5e3Sopenharmony_ci */ 2934514f5e3Sopenharmony_ci bool UnzipWithInflated(const ZipEntry &zipEntry, const uint16_t extraSize, std::ostream &dest) const; 2944514f5e3Sopenharmony_ci /** 2954514f5e3Sopenharmony_ci * @brief Get Entry start. 2964514f5e3Sopenharmony_ci * @param zipEntry Indicates the ZipEntry object. 2974514f5e3Sopenharmony_ci * @param extraSize Indicates the extra size. 2984514f5e3Sopenharmony_ci * @return Returns true if successfully Seeked; returns false otherwise. 2994514f5e3Sopenharmony_ci */ 3004514f5e3Sopenharmony_ci size_t GetEntryStart(const ZipEntry &zipEntry, const uint16_t extraSize) const; 3014514f5e3Sopenharmony_ci /** 3024514f5e3Sopenharmony_ci * @brief Init zlib stream. 3034514f5e3Sopenharmony_ci * @param zstream Indicates the obtained z_stream object. 3044514f5e3Sopenharmony_ci * @return Returns true if successfully init; returns false otherwise. 3054514f5e3Sopenharmony_ci */ 3064514f5e3Sopenharmony_ci bool InitZStream(z_stream &zstream) const; 3074514f5e3Sopenharmony_ci /** 3084514f5e3Sopenharmony_ci * @brief Read zlib stream. 3094514f5e3Sopenharmony_ci * @param buffer Indicates the buffer to read. 3104514f5e3Sopenharmony_ci * @param zstream Indicates the obtained z_stream object. 3114514f5e3Sopenharmony_ci * @param remainCompressedSize Indicates the obtained size. 3124514f5e3Sopenharmony_ci * @return Returns true if successfully read; returns false otherwise. 3134514f5e3Sopenharmony_ci */ 3144514f5e3Sopenharmony_ci bool ReadZStream(const BytePtr &buffer, z_stream &zstream, uint32_t &remainCompressedSize, size_t &startPos) const; 3154514f5e3Sopenharmony_ci 3164514f5e3Sopenharmony_ci bool UnzipWithInflatedFromMMap(const ZipEntry &zipEntry, const uint16_t extraSize, 3174514f5e3Sopenharmony_ci void *mmapDataPtr, std::unique_ptr<uint8_t[]> &dataPtr, size_t &len) const; 3184514f5e3Sopenharmony_ci 3194514f5e3Sopenharmony_ci bool ReadZStreamFromMMap(const BytePtr &buffer, void* &dataPtr, 3204514f5e3Sopenharmony_ci z_stream &zstream, uint32_t &remainCompressedSize) const; 3214514f5e3Sopenharmony_ci 3224514f5e3Sopenharmony_ciprivate: 3234514f5e3Sopenharmony_ci std::string pathName_; 3244514f5e3Sopenharmony_ci std::shared_ptr<ZipFileReader> zipFileReader_; 3254514f5e3Sopenharmony_ci EndDir endDir_; 3264514f5e3Sopenharmony_ci ZipEntryMap entriesMap_; 3274514f5e3Sopenharmony_ci std::shared_ptr<DirTreeNode> dirRoot_; 3284514f5e3Sopenharmony_ci // offset of central directory relative to zip file. 3294514f5e3Sopenharmony_ci ZipPos centralDirPos_ = 0; 3304514f5e3Sopenharmony_ci // this zip content start offset relative to zip file. 3314514f5e3Sopenharmony_ci ZipPos fileStartPos_ = 0; 3324514f5e3Sopenharmony_ci // this zip content length in the zip file. 3334514f5e3Sopenharmony_ci ZipPos fileLength_ = 0; 3344514f5e3Sopenharmony_ci bool isOpen_ = false; 3354514f5e3Sopenharmony_ci}; 3364514f5e3Sopenharmony_ci} // namespace AbilityBase 3374514f5e3Sopenharmony_ci} // namespace OHOS 3384514f5e3Sopenharmony_ci#endif // OHOS_ABILITY_BASE_ZIP_FILE_H 339