WO2012167742A1 - Procédé et appareil permettant d'accéder à des fichiers ressources - Google Patents

Procédé et appareil permettant d'accéder à des fichiers ressources Download PDF

Info

Publication number
WO2012167742A1
WO2012167742A1 PCT/CN2012/076648 CN2012076648W WO2012167742A1 WO 2012167742 A1 WO2012167742 A1 WO 2012167742A1 CN 2012076648 W CN2012076648 W CN 2012076648W WO 2012167742 A1 WO2012167742 A1 WO 2012167742A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
resource
area
name
content
Prior art date
Application number
PCT/CN2012/076648
Other languages
English (en)
Chinese (zh)
Inventor
郑昕
孙健
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2012167742A1 publication Critical patent/WO2012167742A1/fr

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation

Definitions

  • the embodiments of the present invention relate to the field of mobile terminal technologies, and in particular, to a resource file access method and device. Background technique
  • mobile terminals such as mobile phones
  • MMS multimedia, web browsing, video telephony, electronic maps and so on.
  • These functions can be implemented by running the corresponding functional modules (ie applications) on the mobile terminal.
  • the application program can be installed on the mobile terminal by: the mobile terminal obtains the installation package of the application by wired or wireless manner, runs the installation package of the application on the mobile terminal, and installs each file in the package. (such as picture/sound files, etc.) Created on the memory of the mobile terminal.
  • the embodiment of the invention provides a method and a device for accessing a resource file, which are used to solve the technical problems existing in the prior art.
  • An embodiment of the present invention provides a method for accessing a resource file, including:
  • the embodiment of the invention further provides a resource file accessing device, including:
  • a reading module configured to obtain a file name of the resource file to be accessed, and read an index area and a file name area of the resource package file according to the file name of the resource file to be accessed, where the resource package file includes an index area, a file name area and a file content area; a storage path of the storage area, obtained offset information of the resource file to be accessed from the index area; according to the storage path and the offset information, in the file
  • the content area obtains the content of the resource file to be accessed.
  • the method and device for accessing a resource file by making all the resource files into one resource package file, the resource package file is divided into an index area, a file name area, and a file content area, and the reading is stored in the file content area.
  • Path obtaining offset information of the resource file to be accessed from the index area, A large number of file opening/closing operations are saved, which improves the running speed of the mobile terminal and saves power consumption of the mobile terminal.
  • Figure la is a schematic view of an installation package provided in the prior art
  • Figure lb is a schematic diagram of the composition of the installation package in Figure la after decompression
  • FIG. 2 is a flowchart of a method for accessing a resource file according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a method for accessing a resource file according to another embodiment of the present invention
  • FIG. 4 is a flowchart of a method for accessing a resource file according to another embodiment of the present invention
  • FIG. 5 is a resource file according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a device for accessing a resource file according to another embodiment of the present invention.
  • FIG. 2 is a flowchart of a method for accessing a resource file according to an embodiment of the present invention. As shown in FIG. 2, the method includes:
  • Step 201 Obtain a file name of the resource file to be accessed, according to the obtained resource to be accessed.
  • the file name of the file reads the index area and the file name area of the resource package file, and the resource package file includes: an index area, a file name area, and a file content area.
  • the resource file that the program needs to access during operation can be referred to as the resource file to be accessed, and the program accesses the resource file according to the file name of the resource file to be accessed.
  • the resource file included in the program installation package in the prior art is a piece of a resource file.
  • the resource package file provided by the embodiment of the present invention is a binary file, and the binary file includes an index area for recording resource files.
  • the index area is used to save offset information of all resource files in the resource package file, and may include multiple index structures.
  • the binary file also includes a file name area for recording the file name of the resource file and a storage path of the resource file in the resource package file, and the file name area may include multiple file name structures.
  • the binary file also includes a file content area for recording the file content of the resource file, and the file content of each resource file is represented by a binary, which includes a plurality of file content structures.
  • the storage path of the resource file in the resource package file is actually a relative path, and the relative path can be understood as a path for obtaining a resource file from the root directory of the resource file, and the path refers to It is not the disk or sector of the resource file stored on the mobile phone, but the path to the resource file from the root directory of the resource file in the resource package file, so it is a relative path.
  • Step 202 Obtain a storage path of the resource file to be accessed in the file content area from the file name area, obtain offset information of the resource file to be accessed from the index area, and obtain offset information according to the storage path and the offset.
  • the resource file may not start from the first bit of data, but there is an offset, and only the offset is obtained. , in order to access the resource file from the beginning of the resource file.
  • the resource package file may further include: a file header area, The size of the index area, file name area, and file content area, and the respective offsets in the resource bundle file are recorded.
  • the method may further include: accessing a file header area of the resource package file, and obtaining a size and an offset of the index area, the file name area, and the file content area.
  • the file header area may also be used to record at least one: a length of a file header of the resource package file, a version of the resource package file, a size of the resource package file, and a total number of resource files in the resource package file.
  • the flowchart of the access method of the resource file provided by the embodiment of the present invention, as shown in FIG. 3, is provided by the embodiment of the present invention, in order to speed up the storage path and the offset information of the resource file.
  • Methods can include:
  • Step 300 Read the content recorded in the index area and the file name area in the resource package file, and establish an index table of the resource file according to the content recorded in the read index area and the file name area, where the index table includes the resource.
  • the content may include at least an offset of the resource file name recorded in the index area, a length of the resource file name, an offset of the file content of the resource file in the resource package file, and a length of the file content of the resource file, the file name The resource file name and storage path of the zone record.
  • Step 301 Obtain a file name of the resource file to be accessed, and read the index table according to the obtained file name.
  • the index table can exist in the form of a Hashmap.
  • Step 302 Obtain the content of the resource file to be accessed in the file content area according to the storage path and the offset information read in the index table.
  • the method may further include: maintaining an open state of the resource package file, so that a program of the mobile terminal or the like accesses the resource package file. This step preferably occurs after the resource bundle file has been accessed once.
  • FIG. 4 is a flowchart of a method for accessing a resource file according to another embodiment of the present invention.
  • the method uses a mobile phone video program to access a resource file as an example, and the method not only introduces a mobile phone video program client. How to access the resources needed when working on the mobile phone, and further explain how to make a resource package file for mobile video programs, how to make a hand Program installation package for the video program, how to install the mobile video program on the mobile phone, and how to uninstall the mobile video program.
  • the following is a description of the preferred order of occurrence between the various parts described above, but is not intended to limit the scope of the claimed invention. include:
  • Step 401 Create a resource package file of the mobile video program.
  • Obtaining information of all resource files required for the mobile video program wherein the information of the resource file includes: a name, a size, and a content of the resource file, where the foregoing information is saved in a local list; and the resource package is constructed according to the obtained information of the resource file.
  • the file header area structure, index area structure, file name area structure, and file content area structure of the file package the constructed file into a single binary file.
  • the constructed binary file may include structural information such as a file header area structure, an index area structure, a file name area structure, and a file content area structure.
  • the build resource package file may include but is not limited to the following structural information:
  • I file header area save the general information of the resource package file, the number of internal resource files, etc.
  • I index area save the offset information of all resource files, including multiple index structure
  • I file name area save all resource files File name and storage path, including multiple file name structures
  • I file content area which stores the binary content of all resource files, including multiple file contents.
  • Typedef struct ulong m_ JFsoType; ⁇ resource file type
  • Step 402 Create a mobile video program installation package.
  • the single binary resource package file created in step 401 is included in the program installation package, and the single binary resource package file to be produced and the program execution file (such as the file with the suffix exe) are made into a program installation package, which is reduced.
  • Step 403 Install the mobile video program on the mobile phone.
  • the installation process may include: loading a single binary resource package file and a program execution file in the program installation package to a specified location on the mobile phone, since only one resource package file, rather than multiple resource files, avoids repeated readings
  • the operation of the program installation package greatly improves the program installation speed.
  • the client installation speed can be increased by 10 to 20 times.
  • Step 404 The mobile video program starts, and the resource package file is indexed.
  • the file header area of the resource package file is read, and the size of the index area, the file name area, and the file content area are obtained from the file header area of the resource package file, and the resource is in the resource.
  • the offset within the package file According to the size and offset of the index area and the file name area, the information content in the index area is read, and the type of each resource file included in the resource package file, the offset of the resource file name, and the length of the resource file name are obtained.
  • the index table contains at least the name, size, offset, and storage path of the resource file, and hashes the index table The way the table is saved for subsequent quick indexing. Keep the resource bundle file open to effectively reduce the number of times the resource bundle file is opened and closed.
  • Step 405 The mobile video program runs to retrieve the resource file.
  • the mobile video program can retrieve the index table of the resource file established in step 404 according to the required resource file name, and find the storage path and offset position of the corresponding resource file in the resource package file, to the corresponding path. Read the required resource file at the corresponding offset location.
  • Step 406 Uninstall the mobile video program.
  • the resource package files installed to the mobile phone are all physically deleted, because the resource package file provided in the embodiment of the present invention exists in the form of a single binary file, thereby avoiding repeated deletion operations, which greatly improves the The speed at which the program is uninstalled.
  • the access method of the resource file provided by the embodiment of the present invention, by making all the resource files into one resource package file, the resource package file is divided into an index area, a file name area, and a file content area, and the storage path in the file content area is read. Obtaining the offset information of the resource file to be accessed from the index area, obtaining the content of the resource file to be accessed in the file content area according to the storage path and the offset information, thereby avoiding a large number of file opening/closing operations, and improving The running speed of the mobile terminal saves the power loss of the mobile terminal.
  • FIG. 5 is a schematic structural diagram of a device for accessing a resource file according to an embodiment of the present invention. As shown in FIG. 5, the device for accessing a resource file is used to implement the foregoing method, and the device for accessing the resource file includes: Module 501 and processor 502 are taken.
  • the reading module 501 is configured to: obtain a file name of the resource file to be accessed, and read an index area and a file name area of the resource package file according to the file name of the resource file to be accessed, where the resource package file includes an index area, The storage path of the file name area and the file, and the offset information of the resource file to be accessed is obtained from the index area, according to the storage path
  • the resource package file provided by the embodiment of the present invention is a binary file, and the binary file includes an index area for recording the type of the resource file, the offset of the file name of the resource file, the length of the resource file name, and the resource. The offset of the file's file content in the resource bundle file, and the length of the file content of the resource file.
  • the index area is used to save offset information of all resource files in the resource package file, and may include multiple index structures.
  • the binary file further includes a file name area for recording the file name of the resource file and a storage path of the resource file in the resource package file, and the file name area may include multiple file name structures.
  • the binary file also includes a file content area for recording the file content of the resource file, and the file content of each resource file is represented by a binary, which includes a plurality of file content structures.
  • the storage path of the resource file in the resource package file is actually a relative path, and the relative path can be understood as a path for obtaining a resource file from the root directory of the resource file, and the path refers to It is not the disk or sector of the resource file stored on the mobile phone, but the path to the resource file in the resource package file.
  • the path to the resource file is obtained, so it is a relative path.
  • the resource package file may further include: a file header area for recording the size of the index area, the file name area, and the file content area, and an offset within the resource package file.
  • the reading module 501 is further configured to: before reading the index area and the file name area of the resource package file according to the file name of the resource file to be accessed, accessing the file header area of the resource package file to obtain the index area and the file The size of the namespace and file content area and the offset in the resource bundle file.
  • FIG. 6 is a schematic structural diagram of a device for accessing a resource file according to another embodiment of the present invention.
  • the access device of the resource file includes not only the reading module 601 but also processing.
  • the 602, further includes: an establishing module 600, configured to read, before the reading module 601 obtains the file name of the resource file to be accessed, the content recorded in the index area and the file name area in the resource package file; The contents of the index area and the file name area record, and an index table of the resource file is created, and the index table includes the name, size, offset, and storage path of the resource file.
  • the content may include at least an offset of the resource file name recorded in the index area, a length of the resource file name, and The offset of the file content of the resource file in the resource bundle file, and the length of the file content of the resource file, the resource file name and storage path of the file name area record.
  • the reading module 601 is configured to: obtain a file name of the resource file to be accessed, and read an index table established by the establishing module 600 according to the obtained file name.
  • the processor 602 is configured to obtain the content of the resource file to be accessed in the file content area according to the storage path and the offset information read in the index table.
  • the access device for the resource file provided by the embodiment of the present invention, by making all the resource files into one resource package file, the resource package file is divided into an index area, a file name area, and a file content area, and the storage path in the file content area is read. Obtaining the offset information of the resource file to be accessed from the index area, obtaining the content of the resource file to be accessed in the file content area according to the storage path and the offset information, thereby avoiding a large number of file opening/closing operations, and improving The running speed of the mobile terminal saves the power loss of the mobile terminal.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

L'invention concerne un procédé et un appareil permettant d'accéder à des fichiers ressources. Le procédé comprend les étapes suivantes : acquérir un nom de fichier d'un fichier ressources devant être accédé et lire une zone d'index et une zone de nom de fichier d'un fichier paquet de ressources selon le nom de fichier du fichier ressources devant être accédé, le fichier paquet de ressources comprenant une zone d'index, une zone de nom de fichier et une zone de contenu de fichier ; acquérir à partir de la zone de nom de fichier un chemin de stockage du fichier ressources devant être accédé dans la zone de contenu de fichier ; acquérir à partir de la zone d'index des informations de décalage relatives au fichier ressources devant être accédé ; et acquérir un contenu du fichier ressources à accéder dans la zone de contenu de fichier selon le chemin de stockage et les informations de décalage. L'appareil comprend un module de lecture et un processeur.
PCT/CN2012/076648 2011-07-27 2012-06-08 Procédé et appareil permettant d'accéder à des fichiers ressources WO2012167742A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110211991.4 2011-07-27
CN201110211991.4A CN102902687B (zh) 2011-07-27 2011-07-27 资源文件的访问方法及装置

Publications (1)

Publication Number Publication Date
WO2012167742A1 true WO2012167742A1 (fr) 2012-12-13

Family

ID=47295490

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/076648 WO2012167742A1 (fr) 2011-07-27 2012-06-08 Procédé et appareil permettant d'accéder à des fichiers ressources

Country Status (2)

Country Link
CN (1) CN102902687B (fr)
WO (1) WO2012167742A1 (fr)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022057663A1 (fr) * 2020-09-18 2022-03-24 华为技术有限公司 Procédé de génération de fichier et dispositif électronique
US20220107796A1 (en) * 2018-12-25 2022-04-07 Huawei Technologies Co., Ltd. Application Package Splitting and Reassembly Method and Apparatus, and Application Package Running Method and Apparatus

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106055363B (zh) 2016-05-31 2017-11-14 广东欧珀移动通信有限公司 一种识别文件的方法及移动终端
CN107844483B (zh) * 2016-09-18 2020-07-28 腾讯科技(深圳)有限公司 文件管理方法及装置
CN107633088B (zh) * 2017-09-29 2020-04-24 深圳市金证科技股份有限公司 一种文件管理方法及装置
CN110968549B (zh) * 2019-11-18 2024-03-29 Oppo(重庆)智能科技有限公司 文件存储的方法、装置、电子设备及介质

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073633A (zh) * 2009-11-23 2011-05-25 腾讯科技(深圳)有限公司 资源文件的存储访问方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060133410A (ko) * 2005-06-20 2006-12-26 엘지전자 주식회사 복합 미디어 장치에서 파일 검색 및 파일 데이터베이스관리 방법
CN102054038B (zh) * 2010-12-30 2014-05-28 东莞宇龙通信科技有限公司 一种文件解压方法、装置及移动终端

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073633A (zh) * 2009-11-23 2011-05-25 腾讯科技(深圳)有限公司 资源文件的存储访问方法及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220107796A1 (en) * 2018-12-25 2022-04-07 Huawei Technologies Co., Ltd. Application Package Splitting and Reassembly Method and Apparatus, and Application Package Running Method and Apparatus
US12001824B2 (en) * 2018-12-25 2024-06-04 Petal Cloud Technology Co., Ltd. Application package splitting and reassembly method and apparatus, and application package running method and apparatus
WO2022057663A1 (fr) * 2020-09-18 2022-03-24 华为技术有限公司 Procédé de génération de fichier et dispositif électronique

Also Published As

Publication number Publication date
CN102902687A (zh) 2013-01-30
CN102902687B (zh) 2015-09-09

Similar Documents

Publication Publication Date Title
WO2012167742A1 (fr) Procédé et appareil permettant d'accéder à des fichiers ressources
AU2016404863B2 (en) Patch-upgrade-based file processing method and apparatus, terminal, and storage medium
AU2003219640B2 (en) System and method for use of multiple applications
JP5816198B2 (ja) 関連コンピューティングシステム間でコンピューティングオペレーションの結果を共有するためのシステムおよび方法
US20140324945A1 (en) Hydration and dehydration with placeholders
US20120303905A1 (en) Method and apparatus for implementing cache
Peek et al. EnsemBlue: Integrating distributed storage and consumer electronics
US20130067237A1 (en) Providing random access to archives with block maps
WO2011116613A1 (fr) Procédé et dispositif permettant de migrer une version de progiciel
US11422698B2 (en) Method, electronic device, and computer program product for storage management
WO2013044785A1 (fr) Procédé et appareil de sauvegarde de données d'utilisateur
WO2015196621A1 (fr) Procédé et dispositif de tassement de fichiers
WO2021226822A1 (fr) Procédé et appareil d'écriture de journal, dispositif électronique et support de stockage
US8234247B2 (en) Content management system and method for portable device
EP1929677A2 (fr) Systeme permettant d'activer la portabilite d'un logiciel independant de l'hote d'un dispositif autonome
US20140258247A1 (en) Electronic apparatus for data access and data access method therefor
JP2018526740A (ja) モバイル端末のためのデータ記憶方法及び装置
CN102750391A (zh) 一种基于Hadoop分布式文件预览方法及其系统
US20230031033A1 (en) Virtual file system for dynamically providing media content
WO2014101378A1 (fr) Procédé de commande de page et navigateur
WO2019120157A1 (fr) Procédé et dispositif de téléchargement de ressources
SG192868A1 (en) Variants of files in a file system
US20230123921A1 (en) Facilitating the embedding of block references for reducing file access latency file systems
WO2014161289A1 (fr) Procédé et appareil de gestion d'informations
WO2015085764A1 (fr) Procédé d'accès a un fichier et passerelle en nuage

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12796893

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12796893

Country of ref document: EP

Kind code of ref document: A1