WO2021128269A1 - File processing method, file processing device, mobile terminal and server - Google Patents

File processing method, file processing device, mobile terminal and server Download PDF

Info

Publication number
WO2021128269A1
WO2021128269A1 PCT/CN2019/129151 CN2019129151W WO2021128269A1 WO 2021128269 A1 WO2021128269 A1 WO 2021128269A1 CN 2019129151 W CN2019129151 W CN 2019129151W WO 2021128269 A1 WO2021128269 A1 WO 2021128269A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
installation package
package
incremental
decompressed
Prior art date
Application number
PCT/CN2019/129151
Other languages
French (fr)
Chinese (zh)
Inventor
卢阳
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN201980100487.1A priority Critical patent/CN114424162A/en
Priority to PCT/CN2019/129151 priority patent/WO2021128269A1/en
Publication of WO2021128269A1 publication Critical patent/WO2021128269A1/en

Links

Images

Classifications

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

Definitions

  • the mobile terminal When there are updates to the applications, the mobile terminal usually downloads the target application (ie updated application) from the server and installs the target application The program replaces the application program originally installed in the mobile terminal.
  • the target application ie updated application
  • This application provides a file processing method, a file processing device, a mobile terminal, a server, and a computer-readable storage medium, so that the incremental package is downloaded when the application program is updated without the need to download the full amount, which reduces traffic consumption and improves Increased the synthesis speed of the incremental package.
  • the incremental package includes a decompression control field, a compression control field, and a copy control field;
  • copy the file to be copied in the first installation package to the designated file, including the designated file of the file to be copied and the compressed second target file It is the second installation package.
  • an embodiment of the present application provides a file processing method, and the file processing method includes:
  • Compress the incremental file to obtain an incremental package, and insert a decompression control field, a compression control field, and a copy control field in the incremental package.
  • an embodiment of the present application provides a file processing device, and the file processing device includes:
  • An incremental package acquisition module for acquiring an incremental package of an application program, where the incremental package includes a decompression control field, a compression control field, and a copy control field;
  • the first installation package obtaining module is used to obtain the first installation package of the application program
  • the first installation package decompression module is configured to decompress the file to be decompressed in the first installation package using multithreading according to the decompression control field in the incremental package, and decompress it to a first target file;
  • the second target file obtaining module is configured to synthesize the incremental file with the first target file to obtain a second target file
  • the second target file compression module is configured to compress the second target file by using multiple threads according to the compression control field in the incremental packet, and compress it to a designated file;
  • the file copy module is configured to copy the file to be copied in the first installation package to the designated file according to the copy control field in the incremental package, including the file to be copied and the compressed first file
  • the designated file of the second target file is the second installation package.
  • an embodiment of the present application provides a file processing device, and the file processing device includes:
  • the first location obtaining module is configured to obtain the start position and the end position of the file to be decompressed in the first installation package, the start position and the end position of the file to be copied in the first installation package, the The start position and end position of the file to be decompressed in the second installation package, and the start position and end position of the file to be copied in the second installation package;
  • the file decompression module is configured to decompress the files to be decompressed in the first installation package and the files to be decompressed in the second installation package, decompress the files to be decompressed in the first installation package to a first target file, and Decompress the files to be decompressed in the second installation package to the second target file;
  • the second position recording module is used to record the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after compression In a group of compression control fields;
  • the third position recording module is used to record the start position and end position of a file to be copied in the first installation package, and the start position and end position in the second installation package in a set of copies Control field
  • a difference processing module configured to obtain, according to a preset difference algorithm, the decompressed file to be decompressed in the first target file and the incremental file of the decompressed file to be decompressed in the second target file;
  • the incremental package processing module is used to compress the incremental file to obtain the incremental package, and insert a decompression control field, a compression control field, and a copy control field into the incremental package.
  • an embodiment of the present application provides a mobile terminal, including a memory, a processor, and a computer program stored in the memory and running on the processor.
  • the processor executes the computer program, The steps of the file processing method described in the above first aspect are implemented.
  • an embodiment of the present application provides a server, including a memory, a processor, and a computer program stored in the memory and running on the processor.
  • the processor executes the computer program when the computer program is executed. The steps of the file processing method described in the second aspect above.
  • embodiments of the present application provide a computer-readable storage medium that stores a computer program that, when executed by a processor, implements the file processing method described in the first aspect above Or when the computer program is executed by a processor to implement the steps of the file processing method described in the second aspect.
  • the embodiments of the present application provide a computer program product that, when the computer program product runs on a mobile terminal, causes the mobile terminal to execute the steps of the file processing method described in the first aspect; or When the computer program product runs on a server, the server executes the steps of the file processing method described in the second aspect.
  • FIG. 1 is a schematic diagram of the implementation process of the file processing method provided by Embodiment 1 of the present application;
  • FIG. 2 is a schematic diagram of the implementation process of the file processing method provided by the second embodiment of the present application.
  • FIG. 3 is a schematic diagram of the structure of a file processing device provided in Embodiment 3 of the present application.
  • FIG. 1 is a schematic diagram of the implementation process of the file processing method provided in the first embodiment of the present application.
  • the file processing method is applied to a mobile terminal. As shown in the figure, the file processing method may include the following steps:
  • the mobile terminal may periodically poll to detect whether there is an update of the installed application, and when it detects that at least one of the installed applications has an update, obtain the at least one application from the server or a designated device.
  • the incremental package of each application For example, the mobile terminal periodically sends update query request information to the designated device. After the designated device receives the update query request information, it detects whether there is an update to the application installed on the mobile terminal. If there is an update, , Then the incremental package of the updated application program is sent to the mobile terminal.
  • the application in step S101 refers to an updated application in the application installed in the mobile terminal.
  • the installation package of the application installed in the mobile terminal may be referred to as an old installation package, and the application is updated
  • the latter installation package is called the new installation package
  • the incremental package is the difference package between the new installation package of the application and the old installation package
  • the new installation package can be obtained based on the difference package and the old installation package.
  • the version of the new installation package is usually higher than the version of the old installation package, and the version of the application can be upgraded from the old version to the new version through the incremental package.
  • the server may refer to the device that generates the incremental package, and the designated device may refer to the device that stores the incremental package.
  • Step S102 Decompress the incremental package to obtain an incremental file.
  • the incremental package is a compressed package
  • the incremental file is the real incremental file obtained by decompressing the incremental package. It is the difference file between the new installation package of the application and the old installation package, and does not include the decompression control field, Compression control field and copy control field and other information.
  • the decompressing the incremental package to obtain the incremental file includes:
  • the incremental package is decompressed to obtain the incremental file.
  • the verifying the incremental package includes:
  • the target check value of the incremental package can be stored in the incremental package, or the target check value of the incremental package can be stored in the designated device.
  • the mobile terminal After the mobile terminal obtains the incremental package, it can From the target check value obtained from the incremental package or the designated device, the mobile terminal calculates the actual check value of the obtained incremental package, and compares the actual check value with the target check value. If the actual check value is If the verification value is the same as the target, it is determined that the incremental package verification is successful and the incremental package obtained by the mobile terminal is correct.
  • the application currently installed on the mobile terminal can be updated according to the incremental package; if the actual verification value is the same as the target If the check value is not the same, it is determined that the incremental package check fails, and the mobile terminal can download the full amount at this time, thereby realizing the update of the currently installed application program of the mobile terminal.
  • the target check value of the incremental package may refer to the check value of the incremental package obtained from the incremental package or a designated device. For example, after the server obtains the incremental package according to a preset differential algorithm, calculates the value of the incremental package Check value, add the check value to the incremental package, or upload the check value of the incremental package when uploading the incremental package to the specified device.
  • the mobile terminal can obtain the first installation package of the application from its own memory, and the first installation package of the application is the installation package of the application currently installed on the mobile terminal, which can also be referred to as an old installation. package.
  • the designated position is determined by the start position and the end position of the plurality of files to be decompressed recorded in the plurality of sets of decompression control fields in the first target file after decompression.
  • a group of decompression control fields also record the start position and end position of a file to be decompressed in the first target file after decompression. According to the start position and end position of a file to be decompressed in the first target file after decompression, you can change A file to be decompressed is decompressed and stored in the first target file.
  • the first target file includes all files to be decompressed in the first installation package. For example, the first installation package has two files to be decompressed, namely file A and file B.
  • the first target file includes the files after decompression. A and decompressed file B.
  • a group of compression control fields records the start position and end position of a file to be compressed in the second target file in the second target file.
  • one of the second target files can be obtained.
  • files to be compressed if there are multiple sets of compression control fields in the incremental package, multiple files to be compressed in the second target file can be obtained, and the compression tasks of the files to be compressed are distributed to multiple threads, and the multiple threads are concurrently used Executing the task of compressing multiple files to be compressed can improve the compression speed of the multiple files to be compressed in the second target file.
  • a group of compression control fields also record the start position and end position of a file to be compressed in the second installation package after compression.
  • a file to be copied can be set Copy to the specified file to obtain a complete new version installation package.
  • the position of a file to be copied in the designated file can be determined (the start position of a file to be copied in the second installation package is Specify the starting position in the file, and the ending position in the second installation package is the ending position in the specified file), then according to the starting position and ending position of the multiple files to be copied in the second installation package, then The positions of multiple files to be copied in the designated file can be determined, and the second designated position in the designated file includes the positions of the files to be copied in the designated file.
  • inserting the decompression control field, the compression control field, and the copy control field in the incremental package can facilitate the mobile terminal to implement multi-threaded compression and compression during the synthesis process of the first installation package and the incremental package according to these fields. Decompression and copying improve the synthesis speed of the second installation package.
  • the incremental package acquisition module 31 is configured to acquire the incremental package of the application program, where the incremental package includes a decompression control field, a compression control field, and a copy control field;
  • the first installation package decompression module 34 is configured to decompress the file to be decompressed in the first installation package by using multiple threads according to the decompression control field in the incremental package, and decompress it to a first target file;
  • the file copy module 37 is configured to copy the file to be copied in the first installation package to the designated file according to the copy control field in the incremental package, including the file to be copied and the compressed file
  • the designated file of the second target file is the second installation package.
  • a group of decompression control fields records the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression, so
  • the first installation package decompression module 34 is specifically used for:
  • the first set of decompression control fields records the start position and end position of the multiple files to be decompressed in the first installation package. Multiple files to be decompressed in the installation package;
  • the second target file is recorded according to the start positions and end positions of the multiple files to be compressed in the second target file recorded by the multiple sets of compression control fields. Multiple files to be compressed in the target file;
  • the start position and end position of the multiple files to be copied in the second installation package are determined.
  • the installation module is specifically used for:
  • the installation package verification module is specifically used for:
  • the second installation package obtaining module is configured to obtain the second installation package of the application program from the designated device if the verification of the second installation package fails.
  • the incremental package verification module is used to verify the incremental package.
  • the incremental packet verification module is specifically configured to:
  • the to-be-processed file acquisition module 41 is used to acquire the files to be decompressed in the first installation package of the application, the files to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package Files, where the files to be copied refer to files in the first installation package that are not different from those in the second installation package;
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the present application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium. When the program is executed by the processor, it can implement the steps of the foregoing method embodiments.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.

Abstract

A file processing method, a file processing device, a mobile terminal, a server, and a computer-readable storage medium. The method comprises: acquiring an incremental package of an application program (S101); decompressing the incremental package to obtain an incremental file (S102); acquiring a first installation package of the application program (S103); according to a decompression control field in the incremental package, using multithreading to decompress a file to be decompressed in the first installation package into a first target file (S104); synthesizing the incremental file with the first target file to obtain a second target file (S105); according to a compression control field in the incremental package, using multithreading to compress the second target file into a specified file (S106); and according to a copy control field in the incremental package, copying a file to be copied in the first installation package to the specified file, the specified file that comprises the file to be copied and the compressed second target file being a second installation package (S107). By means of the described method, the incremental package can be downloaded when there is an update in the application program without needing to download the full amount, which reduces traffic consumption. Moreover, the synthesis speed of the incremental package is increased by means of multithreading.

Description

文件处理方法、文件处理装置、移动终端及服务器File processing method, file processing device, mobile terminal and server 技术领域Technical field
本申请属于文件处理技术领域,尤其涉及一种文件处理方法、文件处理装置、移动终端、服务器及计算机可读存储介质。This application belongs to the technical field of file processing, and in particular relates to a file processing method, a file processing device, a mobile terminal, a server, and a computer-readable storage medium.
背景技术Background technique
随着通信技术的发展,移动终端上安装的应用程序越来越多,当应用程序存在更新时,通常是移动终端从服务器中下载目标应用程序(即更新后的应用程序),并安装目标应用程序替换移动终端中原先安装的应用程序。With the development of communication technology, more and more applications are installed on mobile terminals. When there are updates to the applications, the mobile terminal usually downloads the target application (ie updated application) from the server and installs the target application The program replaces the application program originally installed in the mobile terminal.
发明内容Summary of the invention
本申请提供一种文件处理方法、文件处理装置、移动终端、服务器及计算机可读存储介质,使得应用程序存在更新时下载增量包,而无需全量下载,减少了流量消耗,并通过多线程提高了增量包的合成速度。This application provides a file processing method, a file processing device, a mobile terminal, a server, and a computer-readable storage medium, so that the incremental package is downloaded when the application program is updated without the need to download the full amount, which reduces traffic consumption and improves Increased the synthesis speed of the incremental package.
第一方面,本申请实施例提供了一种文件处理方法,所述文件处理方法包括:In the first aspect, an embodiment of the present application provides a file processing method, and the file processing method includes:
获取应用程序的增量包,其中,所述增量包包括解压控制字段、压缩控制字段以及拷贝控制字段;Acquiring an incremental package of the application, where the incremental package includes a decompression control field, a compression control field, and a copy control field;
对所述增量包进行解压,获得增量文件;Decompress the incremental package to obtain an incremental file;
获取所述应用程序的第一安装包;Obtaining the first installation package of the application;
根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中的待解压文件进行解压,解压到第一目标文件;According to the decompression control field in the incremental package, use multiple threads to decompress the file to be decompressed in the first installation package, and decompress it to a first target file;
将所述增量文件与所述第一目标文件进行合成,获得第二目标文件;Synthesize the incremental file with the first target file to obtain a second target file;
根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件;According to the compression control field in the delta packet, compress the second target file using multiple threads, and compress it to a designated file;
根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件,包括所述待拷贝文件和压缩后的所述第二目标文件的指定文件为第二安装包。According to the copy control field in the incremental package, copy the file to be copied in the first installation package to the designated file, including the designated file of the file to be copied and the compressed second target file It is the second installation package.
第二方面,本申请实施例提供了一种文件处理方法,所述文件处理方法包括:In the second aspect, an embodiment of the present application provides a file processing method, and the file processing method includes:
获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包中和所述第二安装包中的待拷贝文件,其中,待拷贝文件是指所述第一安装包中和所述第二安装包中不存在差异的文件;Obtain the files to be decompressed in the first installation package of the application, the files to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package, where the files to be copied refer to Files in the first installation package that are not different from those in the second installation package;
获取所述第一安装包中待解压文件的起始位置和结束位置,所述待拷贝文件在所述第一安装包中的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置,以及所述待拷贝文件在所述第二安装包中的起始位置和结束位置;Acquire the start position and end position of the file to be decompressed in the first installation package, the start position and end position of the file to be copied in the first installation package, and the file to be decompressed in the second installation package The starting position and ending position of the file, and the starting position and ending position of the file to be copied in the second installation package;
解压所述第一安装包中待解压文件和所述第二安装包中待解压文件,将所述第一安装包中待解压文件解压到第一目标文件,将所述第二安装包中待解压文件解压到第二目标文件;Decompress the files to be decompressed in the first installation package and the files to be decompressed in the second installation package, decompress the files to be decompressed in the first installation package to a first target file, and extract the files to be decompressed in the second installation package Decompress the decompressed file to the second target file;
获取所述第一安装包中待解压文件解压后在所述第一目标文件中的起始位置和结束位置,以及所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置,其中,所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置是指所述第二目标文件中待压缩文件的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置是指所述第二目标文件中待压缩文件压缩后在所述第二安装包中的起始位置和结束位置;Obtain the start position and the end position of the file to be decompressed in the first installation package in the first target file after being decompressed, and the file to be decompressed in the second installation package in the second target file after being decompressed The start position and the end position of the file to be decompressed in the second installation package after decompression in the second target file refer to the file to be compressed in the second target file Start position and end position, the start position and end position of the file to be decompressed in the second installation package refer to the start position of the file to be compressed in the second target file in the second installation package after compression And end position;
将所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在所述第一目标文件中的起始位置和结束位置记录在一组解压控制字段中;Recording the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression in a set of decompression control fields;
将所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置记录在一组压缩控制字段中;Recording the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after being compressed in a group of compression control fields;
将一个待拷贝文件在所述第一安装包中的起始位置和结束位置,以及在所述第二安装包中的起始位置和结束位置记录在一组拷贝控制字段中;Recording the start position and end position of a file to be copied in the first installation package, and the start position and end position in the second installation package in a set of copy control fields;
根据预设差分算法,获取所述第一目标文件中解压后的待解压文件与所述第二目标文件中解压后的待解压文件的增量文件;Obtaining, according to a preset difference algorithm, an incremental file of the file to be decompressed after decompression in the first target file and the file to be decompressed after decompression in the second target file;
压缩所述增量文件,获得增量包,并在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。Compress the incremental file to obtain an incremental package, and insert a decompression control field, a compression control field, and a copy control field in the incremental package.
第三方面,本申请实施例提供了一种文件处理装置,所述文件处理装置包括:In a third aspect, an embodiment of the present application provides a file processing device, and the file processing device includes:
增量包获取模块,用于获取应用程序的增量包,其中,所述增量包包括解压控制字段、压缩控制字段以及拷贝控制字段;An incremental package acquisition module for acquiring an incremental package of an application program, where the incremental package includes a decompression control field, a compression control field, and a copy control field;
增量文件获取模块,用于对所述增量包进行解压,获得增量文件;An incremental file obtaining module, used to decompress the incremental package to obtain an incremental file;
第一安装包获取模块,用于获取所述应用程序的第一安装包;The first installation package obtaining module is used to obtain the first installation package of the application program;
第一安装包解压模块,用于根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中的待解压文件进行解压,解压到第一目标文件;The first installation package decompression module is configured to decompress the file to be decompressed in the first installation package using multithreading according to the decompression control field in the incremental package, and decompress it to a first target file;
第二目标文件获得模块,用于将所述增量文件与所述第一目标文件进行合成,获得第二目标文件;The second target file obtaining module is configured to synthesize the incremental file with the first target file to obtain a second target file;
第二目标文件压缩模块,用于根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件;The second target file compression module is configured to compress the second target file by using multiple threads according to the compression control field in the incremental packet, and compress it to a designated file;
文件拷贝模块,用于根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件,包括所述待拷贝文件和压缩后的所述第二目标文件的指定文件为第二安装包。The file copy module is configured to copy the file to be copied in the first installation package to the designated file according to the copy control field in the incremental package, including the file to be copied and the compressed first file The designated file of the second target file is the second installation package.
第四方面,本申请实施例提供了一种文件处理装置,所述文件处理装置包括:In a fourth aspect, an embodiment of the present application provides a file processing device, and the file processing device includes:
待处理文件获取模块,用于获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包中与所述第二安装包中的待拷贝文件,其中,待拷贝文件是指所述第一安装包中和所述第二安装包中不存在差异的文件;The file to be processed acquiring module is used to acquire the files to be decompressed in the first installation package of the application, the files to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package , Wherein the file to be copied refers to a file that has no difference between the first installation package and the second installation package;
第一位置获取模块,用于获取所述第一安装包中待解压文件的起始位置和结束位置,所述待拷贝文件在所述第一安装包中的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置,以及所述待拷贝文件在所述第二安装包中的起始位置和结束位置;The first location obtaining module is configured to obtain the start position and the end position of the file to be decompressed in the first installation package, the start position and the end position of the file to be copied in the first installation package, the The start position and end position of the file to be decompressed in the second installation package, and the start position and end position of the file to be copied in the second installation package;
文件解压模块,用于解压所述第一安装包中待解压文件和所述第二安装包中待解压文件,将所述第一安装包中待解压文件解压到第一目标文件,将所述第二安装包中待解压文件解压到第二目标文件;The file decompression module is configured to decompress the files to be decompressed in the first installation package and the files to be decompressed in the second installation package, decompress the files to be decompressed in the first installation package to a first target file, and Decompress the files to be decompressed in the second installation package to the second target file;
第二位置获取模块,用于获取所述第一安装包中待解压文件解压后在所述第一目标文件中的起始位置和结束位置,以及所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置,其中,所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置是指所述第二目标文件中待压缩文件的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置是指所述第二目标文件中待压缩文件压缩后在所述第二安装包中的起始位置和结束位置;The second position obtaining module is used to obtain the start position and the end position of the file to be decompressed in the first installation package after decompression in the first target file, and after the file to be decompressed in the second installation package is decompressed The start position and the end position in the second target file, where the start position and the end position in the second target file after the file to be decompressed in the second installation package is decompressed refer to the first 2. The start position and the end position of the file to be compressed in the target file. The start position and the end position of the file to be decompressed in the second installation package refer to the second target file in the second target file after being compressed. 2. The start position and end position in the installation package;
第一位置记录模块,用于将所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在所述第一目标文件中的起始位置和结束位置记录在一组解压控制字段中;The first position recording module is used to record the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression In a group of decompression control fields;
第二位置记录模块,用于将所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置记录在一组压缩控制字段中;The second position recording module is used to record the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after compression In a group of compression control fields;
第三位置记录模块,用于将一个待拷贝文件在所述第一安装包中的起始位置和结束位置,以及在所述第二安装包中的起始位置和结束位置记录在一组拷贝控制字段中;The third position recording module is used to record the start position and end position of a file to be copied in the first installation package, and the start position and end position in the second installation package in a set of copies Control field
差分处理模块,用于根据预设差分算法,获取所述第一目标文件中解压后的待解 压文件与所述第二目标文件中解压后的待解压文件的增量文件;A difference processing module, configured to obtain, according to a preset difference algorithm, the decompressed file to be decompressed in the first target file and the incremental file of the decompressed file to be decompressed in the second target file;
增量包处理模块,用于压缩所述增量文件,获得增量包,并在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。The incremental package processing module is used to compress the incremental file to obtain the incremental package, and insert a decompression control field, a compression control field, and a copy control field into the incremental package.
第五方面,本申请实施例提供了一种移动终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第一方面所述文件处理方法的步骤。In a fifth aspect, an embodiment of the present application provides a mobile terminal, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, The steps of the file processing method described in the above first aspect are implemented.
第六方面,本申请实施例提供了一种服务器,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第二方面所述文件处理方法的步骤。In a sixth aspect, an embodiment of the present application provides a server, including a memory, a processor, and a computer program stored in the memory and running on the processor. The processor executes the computer program when the computer program is executed. The steps of the file processing method described in the second aspect above.
第七方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上述第一方面所述文件处理方法的步骤;或者所述计算机程序被处理器执行时实现如上述第二方面所述文件处理方法的步骤。In a seventh aspect, embodiments of the present application provide a computer-readable storage medium that stores a computer program that, when executed by a processor, implements the file processing method described in the first aspect above Or when the computer program is executed by a processor to implement the steps of the file processing method described in the second aspect.
第八方面,本申请实施例提供了一种计算机程序产品,当所述计算机程序产品在移动终端上运行时,使得所述移动终端执行如上述第一方面所述文件处理方法的步骤;或者当所述计算机程序产品在服务器上运行时,使得所述服务器执行如上述第二方面所述文件处理方法的步骤。In an eighth aspect, the embodiments of the present application provide a computer program product that, when the computer program product runs on a mobile terminal, causes the mobile terminal to execute the steps of the file processing method described in the first aspect; or When the computer program product runs on a server, the server executes the steps of the file processing method described in the second aspect.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only of the present application. For some embodiments, for those of ordinary skill in the art, other drawings may be obtained based on these drawings without creative labor.
图1是本申请实施例一提供的文件处理方法的实现流程示意图;FIG. 1 is a schematic diagram of the implementation process of the file processing method provided by Embodiment 1 of the present application;
图2是本申请实施例二提供的文件处理方法的实现流程示意图;2 is a schematic diagram of the implementation process of the file processing method provided by the second embodiment of the present application;
图3是本申请实施例三提供的文件处理装置的结构示意图;FIG. 3 is a schematic diagram of the structure of a file processing device provided in Embodiment 3 of the present application;
图4是本申请实施例四提供的文件处理装置的结构示意图;FIG. 4 is a schematic structural diagram of a file processing device provided by Embodiment 4 of the present application;
图5是本申请实施例五提供的移动终端的结构示意图;FIG. 5 is a schematic structural diagram of a mobile terminal according to Embodiment 5 of the present application;
图6是本申请实施例六提供的服务器的结构示意图。FIG. 6 is a schematic diagram of the structure of a server provided in Embodiment 6 of the present application.
具体实施方式Detailed ways
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are proposed for a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from obstructing the description of this application.
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in the specification and appended claims of this application, the term "comprising" indicates the existence of the described features, wholes, steps, operations, elements and/or components, but does not exclude one or more other The existence or addition of features, wholes, steps, operations, elements, components, and/or collections thereof.
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、等仅用于区分描述,而不能理解为指示或暗示相对重要性。In addition, in the description of the specification of this application and the appended claims, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
还应当理解,本实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should also be understood that the size of the sequence number of each step in this embodiment does not mean the order of execution. The execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiment of this application. .
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solutions described in the present application, specific embodiments are used for description below.
参见图1,是本申请实施例一提供的文件处理方法的实现流程示意图,该文件处理方法应用于移动终端,如图所示该文件处理方法可以包括如下步骤:1 is a schematic diagram of the implementation process of the file processing method provided in the first embodiment of the present application. The file processing method is applied to a mobile terminal. As shown in the figure, the file processing method may include the following steps:
步骤S101,获取应用程序的增量包。Step S101: Obtain an incremental package of the application program.
其中,所述增量包包括解压控制字段、压缩控制字段以及拷贝控制字段。Wherein, the incremental packet includes a decompression control field, a compression control field, and a copy control field.
在本申请实施例中,移动终端可以定时轮询检测所安装的应用程序是否存在更新,当检测到所安装的至少一个应用程序存在更新时,从服务器或指定设备中获取上述至少一个应用程序中每个应用程序的增量包,例如,移动终端定时向指定设备发送更新查询请求信息,指定设备在接收到该更新查询请求信息之后,检测移动终端所安装的应用程序是否存在更新,若存在更新,则将存在更新的应用程序的增量包发送至移动终端。其中,步骤S101中的应用程序是指移动终端所安装的应用程序中存在更新的应用程序,可以将移动终端中安装的该应用程序的安装包可以称之为旧安装包,将该应用程序更新后的安装包称之为新安装包,增量包是应用程序的新安装包与旧安装包的差异包,基于差异包和旧安装包可以获得新安装包。需要说明的是,新安装包的版本通常高于旧安装包的版本,通过增量包可以将应用程序的版本由旧版本升级至新版本。其中,服务器可以是指生成增量包的设备,指定设备可以是指存储增量包的设备。In the embodiment of the present application, the mobile terminal may periodically poll to detect whether there is an update of the installed application, and when it detects that at least one of the installed applications has an update, obtain the at least one application from the server or a designated device. The incremental package of each application. For example, the mobile terminal periodically sends update query request information to the designated device. After the designated device receives the update query request information, it detects whether there is an update to the application installed on the mobile terminal. If there is an update, , Then the incremental package of the updated application program is sent to the mobile terminal. Wherein, the application in step S101 refers to an updated application in the application installed in the mobile terminal. The installation package of the application installed in the mobile terminal may be referred to as an old installation package, and the application is updated The latter installation package is called the new installation package, and the incremental package is the difference package between the new installation package of the application and the old installation package, and the new installation package can be obtained based on the difference package and the old installation package. It should be noted that the version of the new installation package is usually higher than the version of the old installation package, and the version of the application can be upgraded from the old version to the new version through the incremental package. The server may refer to the device that generates the incremental package, and the designated device may refer to the device that stores the incremental package.
步骤S102,对所述增量包进行解压,获得增量文件。Step S102: Decompress the incremental package to obtain an incremental file.
其中,增量包为一个压缩包,增量文件是对增量包进行解压所得的真实的增量文件,是应用程序的新安装包与旧安装包的差异文件,并不包括解压控制字段、压缩控制字段以及拷贝控制字段等信息。Among them, the incremental package is a compressed package, and the incremental file is the real incremental file obtained by decompressing the incremental package. It is the difference file between the new installation package of the application and the old installation package, and does not include the decompression control field, Compression control field and copy control field and other information.
可选的,在获取应用程序的增量包之后,还包括:Optionally, after obtaining the incremental package of the application, it also includes:
对所述增量包进行校验;Verifying the incremental package;
相应的,所述对所述增量包进行解压,获得增量文件包括:Correspondingly, the decompressing the incremental package to obtain the incremental file includes:
若所述增量包校验成功,则对所述增量包进行解压,获得所述增量文件。If the verification of the incremental package succeeds, the incremental package is decompressed to obtain the incremental file.
可选的,所述对所述增量包进行校验包括:Optionally, the verifying the incremental package includes:
获取所述增量包的实际校验值;Obtaining the actual check value of the incremental package;
从指定设备或者增量包中获取所述增量包的目标校验值;Obtaining the target check value of the incremental package from a designated device or incremental package;
若所述增量包的实际校验值与所述增量包的目标校验值相同,则确定所述增量包校验成功;If the actual check value of the incremental package is the same as the target check value of the incremental package, determining that the incremental package is successfully verified;
若所述增量包的实际校验值与所述增量包的目标校验值不同,则确定所述增量包校验失败。If the actual check value of the incremental package is different from the target check value of the incremental package, it is determined that the incremental package fails to be verified.
在本申请实施例中,可以在增量包中存储增量包的目标校验值,也可以在指定设备中存储增量包的目标校验值,移动终端在获取到增量包后,可以从该增量包或者指定设备中获取的目标校验值,移动终端计算获取到的增量包的实际校验值,将实际校验值和目标校验值进行比对,若实际校验值与目标校验值相同,则确定增量包校验成功,移动终端获取的增量包正确,可以根据该增量包对移动终端当前所安装的应用程序进行更新;若实际校验值与目标校验值不相同,则确定增量包校验失败,此时移动终端可以进行全量下载,从而实现对移动终端当前所安装应用程序的更新。其中,增量包的目标校验值可以是指从增量包或指定设备中获取的该增量包的校验值,例如服务器根据预设差分算法获得增量包后,计算增量包的校验值,将该校验值添加到增量包中,或者在将增量包上传至指定设备时,也上传增量包的校验值。增量包的实际校验值可以是指移动终端计算的增量包的校验值,移动终端计算增量包的校验值可以是指根据增量包中除校验值之外的内容计算的校验值。其中,上述校验值包括但不限于MD5值、循环冗余校验值等,在计算实际校验值和目标校验值时所使用的校验算法相同。消息摘要算法(Message Digest Algorithm,MD5)是一种密码散列函数,可以产生一个128位(16字节)的散列值,用于确保信息传输完整一致。In the embodiment of the present application, the target check value of the incremental package can be stored in the incremental package, or the target check value of the incremental package can be stored in the designated device. After the mobile terminal obtains the incremental package, it can From the target check value obtained from the incremental package or the designated device, the mobile terminal calculates the actual check value of the obtained incremental package, and compares the actual check value with the target check value. If the actual check value is If the verification value is the same as the target, it is determined that the incremental package verification is successful and the incremental package obtained by the mobile terminal is correct. The application currently installed on the mobile terminal can be updated according to the incremental package; if the actual verification value is the same as the target If the check value is not the same, it is determined that the incremental package check fails, and the mobile terminal can download the full amount at this time, thereby realizing the update of the currently installed application program of the mobile terminal. Among them, the target check value of the incremental package may refer to the check value of the incremental package obtained from the incremental package or a designated device. For example, after the server obtains the incremental package according to a preset differential algorithm, calculates the value of the incremental package Check value, add the check value to the incremental package, or upload the check value of the incremental package when uploading the incremental package to the specified device. The actual check value of the incremental package may refer to the check value of the incremental package calculated by the mobile terminal, and the calculation of the check value of the incremental package by the mobile terminal may refer to the calculation based on the content of the incremental package other than the check value The check value. Wherein, the above-mentioned check value includes but is not limited to MD5 value, cyclic redundancy check value, etc. The check algorithm used when calculating the actual check value and the target check value is the same. The Message Digest Algorithm (MD5) is a cryptographic hash function that can generate a 128-bit (16-byte) hash value to ensure complete and consistent information transmission.
步骤S103,获取所述应用程序的第一安装包。Step S103: Obtain the first installation package of the application program.
在本申请实施例中,移动终端可以从自身存储器中获取应用程序的第一安装包,应用程序的第一安装包是应用程序当前安装在移动终端上的安装包,也可以称之为旧安装包。In the embodiment of the present application, the mobile terminal can obtain the first installation package of the application from its own memory, and the first installation package of the application is the installation package of the application currently installed on the mobile terminal, which can also be referred to as an old installation. package.
步骤S104,根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中 的待解压文件进行解压,解压到第一目标文件。Step S104: Use multithreading to decompress the file to be decompressed in the first installation package according to the decompression control field in the incremental package, and decompress it to the first target file.
在本申请实施例中,根据增量包中的解压控制字段,可以获取第一安装包中的待解压文件,并将第一安装包中待解压文件的解压任务分配到多个线程,使用多个线程同时对第一安装包中待解压文件进行解压,可以提高对第一安装包的解压速度。其中,使用多线程对第一安装包中待解压文件进行解压可以是指使用多个线程并发执行对第一安装包中多个待解压文件的解压任务。第一目标文件是对第一安装包中待解压文件进行解压后所得的文件,包括已解压文件。In the embodiment of the present application, according to the decompression control field in the incremental package, the file to be decompressed in the first installation package can be obtained, and the decompression task of the file to be decompressed in the first installation package can be distributed to multiple threads. Each thread decompresses the files to be decompressed in the first installation package at the same time, which can improve the decompression speed of the first installation package. Wherein, using multiple threads to decompress the files to be decompressed in the first installation package may refer to using multiple threads to concurrently execute decompression tasks for the multiple files to be decompressed in the first installation package. The first target file is a file obtained by decompressing the file to be decompressed in the first installation package, including the decompressed file.
可选的,一组解压控制字段记录所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在第一目标文件中的起始位置和结束位置,所述根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中待解压文件进行解压,解压到第一目标文件包括:Optionally, a group of decompression control fields records the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression, so According to the decompression control field in the incremental package, using multiple threads to decompress the file to be decompressed in the first installation package, and decompressing to the first target file includes:
在所述增量包中包括多组解压控制字段时,根据所述多组解压控制字段记录的所述第一安装包中多个待解压文件的起始位置和结束位置,获取所述第一安装包中多个待解压文件;When the delta package includes multiple sets of decompression control fields, the first set of decompression control fields records the start position and end position of the multiple files to be decompressed in the first installation package. Multiple files to be decompressed in the installation package;
将所述多个待解压文件的解压任务分配到多个线程;Allocating the decompression tasks of the multiple files to be decompressed to multiple threads;
使用所述多个线程对所述多个待解压文件进行解压,并将解压后的所述多个待解压文件存储到所述第一目标文件中指定位置,其中,所述第一目标文件中指定位置是由所述多组解压控制字段记录的所述多个待解压文件解压后在所述第一目标文件中的起始位置和结束位置确定的。Use the multiple threads to decompress the multiple files to be decompressed, and store the multiple files to be decompressed after decompression in a specified location in the first target file, where the first target file The designated position is determined by the start position and the end position of the plurality of files to be decompressed recorded in the plurality of sets of decompression control fields in the first target file after decompression.
在本申请实施例中,一组解压控制字段记录第一安装包中一个待解压文件在第一安装包中的起始位置和结束位置,根据一组解压控制字段可以获取第一安装包中一个待解压文件,如果增量包中有多组解压控制字段,就可以获取第一安装包中多个待解压文件,将多个待解压文件的解压任务分配到多个线程,通过多个线程并发执行对多个待解压文件的解压任务,可以提高对第一安装包中多个待解压文件的解压速度。一组解压控制字段还记录一个待解压文件解压后在第一目标文件中的起始位置和结束位置,根据一个待解压文件解压后在第一目标文件中的起始位置和结束位置,可以将一个待解压文件解压后存储到第一目标文件中。其中,第一目标文件包括第一安装包中所有待解压文件解压后所得文件,例如第一安装包有两个待解压文件,分别为文件A和文件B,第一目标文件包括解压后的文件A和解压后的文件B。In the embodiment of the present application, a group of decompression control fields records the start position and end position of a file to be decompressed in the first installation package in the first installation package. According to a group of decompression control fields, one of the first installation packages can be obtained. For files to be decompressed, if there are multiple sets of decompression control fields in the incremental package, multiple files to be decompressed in the first installation package can be obtained, and the decompression tasks of the files to be decompressed are distributed to multiple threads, and concurrently through multiple threads Executing the task of decompressing multiple files to be decompressed can increase the speed of decompressing multiple files to be decompressed in the first installation package. A group of decompression control fields also record the start position and end position of a file to be decompressed in the first target file after decompression. According to the start position and end position of a file to be decompressed in the first target file after decompression, you can change A file to be decompressed is decompressed and stored in the first target file. The first target file includes all files to be decompressed in the first installation package. For example, the first installation package has two files to be decompressed, namely file A and file B. The first target file includes the files after decompression. A and decompressed file B.
步骤S105,将所述增量文件与所述第一目标文件进行合成,获得第二目标文件。Step S105: Synthesize the incremental file and the first target file to obtain a second target file.
其中,第二目标文件是增量文件与第一目标文件合成后所得文件,第二目标文件包括增量文件和第一目标文件。The second target file is a file obtained by synthesizing the incremental file and the first target file, and the second target file includes the incremental file and the first target file.
步骤S106,根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件。Step S106: According to the compression control field in the delta packet, the second target file is compressed using multiple threads to compress it to a designated file.
在本申请实施例中,根据增量包中的压缩控制字段,可以获取第二目标文件中的待压缩文件,并将第二目标文件中待压缩文件的压缩任务分配到多个线程,使用多个线程同时对第二目标文件中待压缩文件进行压缩,可以提高对第二目标文件的压缩速度。其中,使用多线程对第二目标文件中待压缩文件进行压缩可以是指使用多线程并发执行对第二目标文件中多个待压缩文件的压缩任务。指定文件是对第二目标文件中待压缩文件进行压缩后所得的压缩包,包括已压缩文件。In the embodiment of the present application, according to the compression control field in the delta packet, the file to be compressed in the second target file can be obtained, and the compression task of the file to be compressed in the second target file can be distributed to multiple threads. A thread simultaneously compresses the file to be compressed in the second target file, which can improve the compression speed of the second target file. Wherein, using multiple threads to compress the files to be compressed in the second target file may refer to using multiple threads to concurrently execute compression tasks for multiple files to be compressed in the second target file. The designated file is a compressed package obtained by compressing the file to be compressed in the second target file, including the compressed file.
可选的,一组压缩控制字段记录所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置,所述根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件包括:Optionally, a group of compression control fields records the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after compression , Said compressing the second target file using multiple threads according to the compression control field in the delta packet, and compressing to a designated file includes:
在所述增量包中包括多组压缩控制字段时,根据所述多组压缩控制字段记录的所述第二目标文件中多个待压缩文件的起始位置和结束位置,获取所述第二目标文件中 多个待压缩文件;When the incremental packet includes multiple sets of compression control fields, the second target file is recorded according to the start positions and end positions of the multiple files to be compressed in the second target file recorded by the multiple sets of compression control fields. Multiple files to be compressed in the target file;
将所述多个待压缩文件的压缩任务分配到多个线程;Allocating the compression tasks of the multiple files to be compressed to multiple threads;
使用所述多个线程对所述多个待压缩文件进行压缩,并将压缩后的所述多个待压缩文件存储到所述指定文件中第一指定位置,其中,所述指定文件中第一指定位置是由所述多组压缩控制字段记录的所述多个待压缩文件在所述第二安装包中的起始位置和结束位置确定的。The multiple threads are used to compress the multiple files to be compressed, and the multiple compressed files to be compressed are stored in a first specified location in the specified file, where the first specified file is The designated position is determined by the start position and the end position of the plurality of files to be compressed recorded in the plurality of sets of compression control fields in the second installation package.
在本申请实施例中,一组压缩控制字段记录第二目标文件中一个待压缩文件在第二目标文件中的起始位置和结束位置,根据一组压缩控制字段可以获取第二目标文件中一个待压缩文件,如果增量包中有多组压缩控制字段,就可以获取第二目标文件中多个待压缩文件,将多个待压缩文件的压缩任务分配到多个线程,通过多个线程并发执行对多个待压缩文件的压缩任务,可以提高对第二目标文件中多个待压缩文件的压缩速度。一组压缩控制字段还记录一个待压缩文件压缩后在第二安装包中的起始位置和结束位置,根据一个待压缩文件压缩后在第二安装包中的起始位置和结束位置,可以将一个待压缩文件压缩后存储到指定文件中。其中,根据一个待压缩文件压缩后在第二安装包中的起始位置和结束位置,可以确定一个待压缩文件压缩后在指定文件中的位置(一个待压缩文件压缩后在第二安装包中的起始位置就是在指定文件中的起始位置,在第二安装包中的结束位置就是在指定文件中的结束位置),那么根据多个待压缩文件压缩后分别在第二安装包中的起始位置和结束位置,就可以确定多个待压缩文件压缩后分别在指定文件中的位置,指定文件中第一指定位置包括多个待压缩文件分别在指定文件中的位置。In the embodiment of the present application, a group of compression control fields records the start position and end position of a file to be compressed in the second target file in the second target file. According to a group of compression control fields, one of the second target files can be obtained. For files to be compressed, if there are multiple sets of compression control fields in the incremental package, multiple files to be compressed in the second target file can be obtained, and the compression tasks of the files to be compressed are distributed to multiple threads, and the multiple threads are concurrently used Executing the task of compressing multiple files to be compressed can improve the compression speed of the multiple files to be compressed in the second target file. A group of compression control fields also record the start position and end position of a file to be compressed in the second installation package after compression. According to the start position and end position of a file to be compressed in the second installation package after compression, you can change A file to be compressed is compressed and stored in the specified file. Among them, according to the start position and end position of a to-be-compressed file in the second installation package after compression, the position of a to-be-compressed file in the specified file after compression can be determined (a to-be-compressed file is compressed in the second installation package The starting position is the starting position in the specified file, and the ending position in the second installation package is the ending position in the specified file), then according to the multiple files to be compressed after being compressed in the second installation package The start position and the end position can determine the positions of the multiple files to be compressed in the designated file after compression. The first designated position in the designated file includes the positions of the files to be compressed in the designated file.
步骤S107,根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件,包括所述待拷贝文件和压缩后的所述第二目标文件的指定文件为第二安装包。Step S107: According to the copy control field in the incremental package, copy the file to be copied in the first installation package to the designated file, including the file to be copied and the compressed second target file The specified file is the second installation package.
在本申请实施例中,根据增量包中的拷贝控制字段,可以获取第一安装包中的待拷贝文件,并将第一安装包中待拷贝文件的拷贝到指定文件,也可以将第一安装包中待拷贝文件的拷贝任务分配到多个线程,使用多个线程同时对第一安装包中多个待拷贝文件进行拷贝,可以提高对第一安装包中待拷贝文件的拷贝速度。其中,包括待拷贝文件和压缩后的第二目标文件的指定文件即为合成的新版本安装包(即在移动终端合成的第二安装包)。In the embodiment of the present application, according to the copy control field in the incremental package, the file to be copied in the first installation package can be obtained, and the file to be copied in the first installation package can be copied to the specified file, or the first The copy task of the files to be copied in the installation package is distributed to multiple threads, and multiple threads are used to copy multiple files to be copied in the first installation package at the same time, which can increase the copy speed of the files to be copied in the first installation package. Among them, the designated file including the file to be copied and the compressed second target file is the synthesized new version installation package (that is, the second installation package synthesized on the mobile terminal).
可选的,一组拷贝控制字段记录一个待拷贝文件在所述第一安装包中起始位置和结束位置以及在所述第二安装包中的起始位置和结束位置,所述根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件包括:Optionally, a group of copy control fields records the start position and end position of a file to be copied in the first installation package and the start position and end position in the second installation package, and the The copy control field in the incremental package, copying the file to be copied in the first installation package to the designated file includes:
在所述增量包中包括多组拷贝控制字段时,根据所述多组拷贝控制字段记录的多个待拷贝文件在所述第一安装包中的起始位置和结束位置,获取所述第一安装包中多个待拷贝文件;When multiple sets of copy control fields are included in the delta package, the first installation package is obtained according to the start positions and end positions of the multiple files to be copied recorded in the multiple sets of copy control fields in the first installation package. Multiple files to be copied in one installation package;
将所述多个待拷贝文件的拷贝任务分配到多个线程;Allocating the copy tasks of the multiple files to be copied to multiple threads;
使用所述多个线程将所述多个待拷贝文件拷贝到所述指定文件中第二指定位置,其中,所述指定文件中第二指定位置是由所述多组拷贝控制字段记录的所述多个待拷贝文件在所述第二安装包中的起始位置和结束位置确定的。Use the multiple threads to copy the multiple files to be copied to a second specified location in the specified file, wherein the second specified location in the specified file is the set of copy control fields recorded by the multiple copy control fields. The start position and end position of the multiple files to be copied in the second installation package are determined.
在本申请实施例中,一组拷贝控制字段记录第一安装包中一个待拷贝文件在第一安装包中的起始位置和结束位置,根据一组拷贝控制字段可以获取第一安装包中一个待拷贝文件,如果增量包中有多组拷贝控制字段,就可以获取第一安装包中多个待拷贝文件,将多个待拷贝文件的拷贝任务分配到多个线程,通过多个线程并发执行对多个待拷贝文件的拷贝任务,可以提高第一安装包中多个待拷贝文件的拷贝速度。一组拷贝控制字段还记录一个待拷贝文件在第二安装包中的起始位置和结束位置,根据一个待拷贝文件在第二安装包中的起始位置和结束位置,可以将一个待拷贝文件拷贝到 指定文件中,从而获得完整的新版本安装包。其中,根据一个待拷贝文件在第二安装包中的起始位置和结束位置,可以确定一个待拷贝文件在指定文件中的位置(一个待拷贝文件在第二安装包中的起始位置就是在指定文件中的起始位置,在第二安装包中的结束位置就是在指定文件中的结束位置),那么根据多个待拷贝文件分别在第二安装包中的起始位置和结束位置,就可以确定多个待拷贝文件分别在指定文件中的位置,指定文件中第二指定位置包括多个待拷贝文件分别在指定文件中的位置。In the embodiment of the present application, a set of copy control fields records the start position and end position of a file to be copied in the first installation package in the first installation package. According to a set of copy control fields, one of the first installation packages can be obtained. For files to be copied, if there are multiple sets of copy control fields in the incremental package, multiple files to be copied in the first installation package can be obtained, and the copy tasks of multiple files to be copied can be distributed to multiple threads, and concurrently through multiple threads Performing a copy task of multiple files to be copied can increase the copy speed of multiple files to be copied in the first installation package. A group of copy control fields also record the start position and end position of a file to be copied in the second installation package. According to the start position and end position of a file to be copied in the second installation package, a file to be copied can be set Copy to the specified file to obtain a complete new version installation package. Among them, according to the start position and end position of a file to be copied in the second installation package, the position of a file to be copied in the designated file can be determined (the start position of a file to be copied in the second installation package is Specify the starting position in the file, and the ending position in the second installation package is the ending position in the specified file), then according to the starting position and ending position of the multiple files to be copied in the second installation package, then The positions of multiple files to be copied in the designated file can be determined, and the second designated position in the designated file includes the positions of the files to be copied in the designated file.
可选的,在获得第二安装包之后,本申请实施例还包括:Optionally, after obtaining the second installation package, the embodiment of the present application further includes:
安装所述第二安装包。Install the second installation package.
在本申请实施例中,移动终端在获取到第二安装包之后,可以自动安装第二安装包,也可以发出提示信息,提示用户获取到第二安装包,在接收到用户触发的安装指令时,安装第二安装包,替换移动终端中的第一安装包,完成对应用程序的更新。例如,应用程序A的第一安装包和第二安装包,将安装在移动终端中的第一安装包替换为第二安装包,可以完成对移动终端所安装应用程序A的更新。In the embodiment of the present application, after obtaining the second installation package, the mobile terminal may automatically install the second installation package, or may send a prompt message to prompt the user to obtain the second installation package. When receiving the installation instruction triggered by the user , Install the second installation package, replace the first installation package in the mobile terminal, and complete the update of the application program. For example, for the first installation package and the second installation package of application A, the first installation package installed in the mobile terminal is replaced with the second installation package to complete the update of the application A installed on the mobile terminal.
可选的,在安装所述第二安装包之前,还包括:Optionally, before installing the second installation package, it further includes:
对所述第二安装包进行校验;Verifying the second installation package;
相应的,所述安装所述第二安装包包括:Correspondingly, the installing the second installation package includes:
若所述第二安装包校验成功,则安装所述第二安装包;If the verification of the second installation package is successful, install the second installation package;
若所述第二安装包校验失败,则从指定设备中获取所述应用程序的第二安装包。If the verification of the second installation package fails, the second installation package of the application program is obtained from the designated device.
在本申请实施例中,在将合成的第二安装包安装到移动终端之前,可以先对第二安装包进行校验,校验在移动终端合成的第二安装包是否与指定设备提供的第二安装包是否一致,保证移动终端安装的第二安装包为正确的第二安装包,该正确的第二安装包即为服务器上传到指定设备的第二安装包。In the embodiment of the present application, before installing the synthesized second installation package on the mobile terminal, the second installation package may be verified first to verify whether the second installation package synthesized on the mobile terminal is compatible with the second installation package provided by the designated device. Second, whether the installation packages are consistent, to ensure that the second installation package installed by the mobile terminal is the correct second installation package, and the correct second installation package is the second installation package uploaded by the server to the designated device.
可选的,所述对所述第二安装包进行校验包括:Optionally, the verifying the second installation package includes:
获取所述第二安装包的实际校验值;Obtaining the actual check value of the second installation package;
从指定设备或者所述增量包中获取所述第二安装包的目标校验值;Obtaining the target check value of the second installation package from a designated device or the incremental package;
若所述第二安装包的实际校验值与所述第二安装包的目标校验值相同,则确定所述第二安装包校验成功;If the actual verification value of the second installation package is the same as the target verification value of the second installation package, it is determined that the verification of the second installation package is successful;
若所述第二安装包的实际校验值与所述第二安装包的目标校验值不同,则确定所述第二安装包校验失败。If the actual verification value of the second installation package is different from the target verification value of the second installation package, it is determined that the verification of the second installation package fails.
在本申请实施例中,移动终端可以从指定设备或增量包中获取第二安装包的目标校验值,移动终端计算合成的第二安装包的实际校验值,将第二安装包的实际校验值和目标校验值进行比对,若第二安装包的实际校验值与目标校验值相同,则确定移动终端合成的第二安装包校验成功,即移动终端合成得到的第二安装包正确;若第二安装包的实际校验值与目标校验值不相同,则确定移动终端合成的第二安装包校验失败,即移动终端合成得到的第二安装包有误,此时为了实现对移动终端上应用程序的更新,移动终端可以从指定设备中进行全量下载,即从指定设备中下载正确的第二安装包。其中,在计算第二安装包的实际校验值和目标校验值时所使用的校验算法相同,例如可以是循环冗余校验算法、消息摘要算法中的任一种算法,也可以是其他校验算法,在此不做限定。In the embodiment of the present application, the mobile terminal may obtain the target check value of the second installation package from the specified device or incremental package, the mobile terminal calculates the actual check value of the synthesized second installation package, and replaces The actual check value is compared with the target check value. If the actual check value of the second installation package is the same as the target check value, it is determined that the second installation package synthesized by the mobile terminal is successfully verified, that is, the mobile terminal synthesized The second installation package is correct; if the actual verification value of the second installation package is not the same as the target verification value, it is determined that the verification of the second installation package synthesized by the mobile terminal has failed, that is, the second installation package synthesized by the mobile terminal is incorrect At this time, in order to update the application on the mobile terminal, the mobile terminal can download the full amount from the designated device, that is, download the correct second installation package from the designated device. Wherein, the check algorithm used when calculating the actual check value and the target check value of the second installation package is the same, for example, it may be any of the cyclic redundancy check algorithm and the message digest algorithm, or it may be Other verification algorithms are not limited here.
本申请实施例通过移动终端获取待更新的应用程序的增量包,将该增量包与移动终端已安装的该应用程序的旧安装包进行合成,即可获取该应用程序的新安装包,而无需移动终端对新安装包进行全量下载,可以减少移动终端的流量消耗,并通过增量包中插入的解压控制字段以及压缩控制字段,可以在文件合成过程中实现多线程的解压和压缩,提高了合成过程中的压缩解压速度,从而提高了增量包的合成速度。In this embodiment of the application, the mobile terminal obtains the incremental package of the application to be updated, and synthesizes the incremental package with the old installation package of the application that has been installed on the mobile terminal to obtain the new installation package of the application. There is no need for the mobile terminal to download the new installation package in full, which can reduce the traffic consumption of the mobile terminal. Through the decompression control field and the compression control field inserted in the incremental package, multi-threaded decompression and compression can be realized in the file synthesis process. Improve the speed of compression and decompression in the synthesis process, thereby increasing the synthesis speed of the incremental package.
参见图2,是本申请实施例二提供的文件处理方法的实现流程示意图,该文件处理 方法应用于服务器,如图所示该文件处理方法可以包括如下步骤:Refer to Figure 2, which is a schematic diagram of the implementation process of the file processing method provided in the second embodiment of the present application. The file processing method is applied to the server. As shown in the figure, the file processing method may include the following steps:
步骤S201,获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包中和所述第二安装包中的待拷贝文件。Step S201: Obtain the files to be decompressed in the first installation package of the application, the files to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package.
其中,待拷贝文件是指所述第一安装包中和所述第二安装包中不存在差异的文件。The file to be copied refers to a file that has no difference between the first installation package and the second installation package.
在本申请实施例中,服务器中存储有应用程序的第一安装包(即旧安装包)和第二安装包(即新安装包),可以从第一安装包和第二安装包中分别获取待解压文件以及待拷贝文件。In the embodiment of the present application, the first installation package (that is, the old installation package) and the second installation package (that is, the new installation package) of the application program are stored in the server, which can be obtained from the first installation package and the second installation package respectively Files to be decompressed and files to be copied.
可选的,所述获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包和所述第二安装包中的待拷贝文件包括:Optionally, the file to be decompressed in the first installation package of the obtained application, the file to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package include:
遍历所述应用程序的第一安装包中文件和第二安装包中文件,获取所述第一安装包中每个文件的校验值以及所述第二安装包中每个文件的校验值;Traverse the files in the first installation package and the files in the second installation package of the application to obtain the check value of each file in the first installation package and the check value of each file in the second installation package ;
获取所述第一安装包中校验值与所述第二安装包中校验值相同的文件,确定该文件为待拷贝文件;Acquiring a file with the same check value in the first installation package as the check value in the second installation package, and determining that the file is a file to be copied;
确定所述第一安装包中除所述待拷贝文件之外的文件为所述第一安装包中待解压文件,所述第二安装包中除所述待拷贝文件之外的文件为所述第二安装包中待解压文件。It is determined that the files in the first installation package other than the files to be copied are the files to be decompressed in the first installation package, and the files in the second installation package other than the files to be copied are the Files to be decompressed in the second installation package.
在本申请实施例中,第一安装包中校验值与第二安装包中校验值相同的文件,其文件名称和文件内容在第一安装包和第二安装包中通常相同,不存在差异,在移动终端合成第二安装包时,可以直接将第一安装包中的待拷贝文件拷贝到第二安装包,而无需从指定设备或服务器上获取第一安装包和第二安装包中相同的文件。In the embodiment of the present application, the file with the same check value in the first installation package and the check value in the second installation package has the same file name and file content in the first installation package and the second installation package, and does not exist The difference is that when the mobile terminal synthesizes the second installation package, the files to be copied in the first installation package can be directly copied to the second installation package without obtaining the first installation package and the second installation package from the designated device or server. The same file.
步骤S202,获取所述第一安装包中待解压文件的起始位置和结束位置,所述待拷贝文件在所述第一安装包中的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置,以及所述待拷贝文件在所述第二安装包中的起始位置和结束位置。Step S202: Obtain the start position and the end position of the file to be decompressed in the first installation package, the start position and the end position of the file to be copied in the first installation package, and the start position and end position of the file to be copied in the first installation package. The start position and end position of the file to be decompressed, and the start position and end position of the file to be copied in the second installation package.
其中,第一安装包中待解压文件的起始位置和结束位置可以是指第一安装包中待解压文件在第一安装包中的起始位置和结束位置,移动终端根据上述位置可以从本地安装的第一安装包中获取待解压文件;第二安装包中待解压文件的起始位置和结束位置可以是指第二安装包中待解压文件在第二安装包中的起始位置和结束位置,移动终端根据该位置可以将待压缩文件压缩到第二安装包的相应位置;待拷贝文件在第一安装包中的起始位置和结束位置,可以使得移动终端根据上述位置从第一安装包中获取待拷贝文件,并根据待拷贝文件在第二安装包中的起始位置和结束位置,将从第一安装包中获取的待拷贝文件拷贝到第二安装包的相应位置。Wherein, the start position and end position of the file to be decompressed in the first installation package may refer to the start position and end position of the file to be decompressed in the first installation package in the first installation package. The file to be decompressed is obtained from the installed first installation package; the start position and end position of the file to be decompressed in the second installation package may refer to the start position and end of the file to be decompressed in the second installation package in the second installation package Position, the mobile terminal can compress the file to be compressed to the corresponding position of the second installation package according to the position; the start position and end position of the file to be copied in the first installation package can make the mobile terminal install from the first installation package according to the above position The file to be copied is obtained from the package, and the file to be copied obtained from the first installation package is copied to the corresponding position of the second installation package according to the start position and the end position of the file to be copied in the second installation package.
步骤S203,解压所述第一安装包中待解压文件和所述第二安装包中待解压文件,将所述第一安装包中待解压文件解压到第一目标文件,将所述第二安装包中待解压文件解压到第二目标文件。Step S203, decompress the files to be decompressed in the first installation package and the files to be decompressed in the second installation package, decompress the files to be decompressed in the first installation package to a first target file, and install the second installation package. The file to be decompressed in the package is decompressed to the second target file.
在本申请实施例中,将第一安装包中待解压文件解压到第一目标文件,可以获取第一安装包中待解压文件在第一目标文件中的起始位置和结束位置;将第二安装包中待解压文件解压到第二目标文件,可以获取第二安装包中待解压文件在第二目标文件中的起始位置和结束位置。In the embodiment of the present application, by decompressing the file to be decompressed in the first installation package to the first target file, the start position and the end position of the file to be decompressed in the first installation package in the first target file can be obtained; The file to be decompressed in the installation package is decompressed to the second target file, and the start position and the end position of the file to be decompressed in the second installation package in the second target file can be obtained.
步骤S204,获取所述第一安装包中待解压文件解压后在所述第一目标文件中的起始位置和结束位置,以及所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置。Step S204: Obtain the start position and end position of the file to be decompressed in the first installation package in the first target file after being decompressed, and the file to be decompressed in the second installation package after being decompressed in the second The start position and end position in the target file.
其中,所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置是指所述第二目标文件中待压缩文件的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置是指所述第二目标文件中待压缩文件压缩后在所述第二安装包中的起始位置和结束位置。Wherein, the start position and end position of the file to be decompressed in the second target file after decompression in the second installation package refer to the start position and end position of the file to be compressed in the second target file, so The start position and the end position of the file to be decompressed in the second installation package refer to the start position and the end position of the file to be compressed in the second target file in the second installation package after being compressed.
步骤S205,将所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在所述第一目标文件中的起始位置和结束位置记录在一组解压控制字段中。Step S205: Record the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression in a set of decompression control Field.
步骤S206,将所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置记录在一组压缩控制字段中。Step S206: Record the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after being compressed in a group of compression controls Field.
步骤S207,将一个待拷贝文件在所述第一安装包中的起始位置和结束位置,以及在所述第二安装包中的起始位置和结束位置记录在一组拷贝控制字段中。Step S207: Record the start position and end position of a file to be copied in the first installation package, and the start position and end position in the second installation package in a set of copy control fields.
步骤S208,根据预设差分算法,获取所述第一目标文件中解压后的待解压文件与所述第二目标文件中解压后的待解压文件的增量文件。Step S208: Obtain an incremental file of the file to be decompressed after decompression in the first target file and the file to be decompressed after decompression in the second target file according to a preset difference algorithm.
其中,上述增量文件可以是指应用程序的第一安装包与第二安装包的差异文件。上述预设差分算法可以是指预先设置的能够获取应用程序的第一安装包与第二安装包的增量文件的算法,包括但不限于bsdiff算法。The above-mentioned incremental file may refer to a difference file between the first installation package and the second installation package of the application program. The aforementioned preset difference algorithm may refer to a preset algorithm capable of obtaining the incremental files of the first installation package and the second installation package of the application, including but not limited to the bsdiff algorithm.
步骤S209,压缩所述增量文件,获得增量包,并在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。Step S209: Compress the incremental file to obtain an incremental package, and insert a decompression control field, a compression control field, and a copy control field into the incremental package.
在本申请实施例中,在增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段,可以便于移动终端根据这些字段在第一安装包和增量包的合成过程中实现多线程压缩、解压以及拷贝,提高了第二安装包的合成速度。In the embodiment of the present application, inserting the decompression control field, the compression control field, and the copy control field in the incremental package can facilitate the mobile terminal to implement multi-threaded compression and compression during the synthesis process of the first installation package and the incremental package according to these fields. Decompression and copying improve the synthesis speed of the second installation package.
可选的,在获得增量包之后,还包括:Optionally, after obtaining the incremental package, it also includes:
将所述增量包与所述第一安装包进行合成,获得合成包;Synthesize the incremental package and the first installation package to obtain a composite package;
对所述合成包进行校验;Verifying the synthetic package;
相应的,所述在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段包括:Correspondingly, inserting a decompression control field, a compression control field, and a copy control field in the incremental packet includes:
若所述合成包校验成功,则在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。If the composite packet is successfully verified, insert a decompression control field, a compression control field, and a copy control field in the incremental packet.
在本申请实施例中,服务器在将解压控制字段、压缩控制字段以及拷贝控制字段插入增量包之前,可以先将增量包与第一安装包进行合成,通过校验合成包,可以判断服务器获取的增量包是否正确,若校验成功,则确定服务器获取的增量包正确,若校验失败,则确定服务器获取的增量包有误,可以对有误的增量包进行标记,提示服务器重新获取应用程序的增量包。In the embodiment of the present application, before inserting the decompression control field, compression control field, and copy control field into the incremental package, the server may first synthesize the incremental package with the first installation package, and by verifying the composite package, the server can be judged Whether the obtained incremental package is correct, if the verification is successful, it is determined that the incremental package obtained by the server is correct; if the verification fails, it is determined that the incremental package obtained by the server is incorrect, and the incorrect incremental package can be marked. Prompt the server to reacquire the incremental package of the application.
可选的,所述对所述合成包进行校验包括:Optionally, the verifying the composite packet includes:
获取所述合成包的校验值;Obtaining the check value of the synthetic package;
获取所述第二安装包的校验值;Acquiring the check value of the second installation package;
若所述合成包的校验值与所述第二安装包的校验值相同,则确定所述合成包校验成功;If the check value of the composite package is the same as the check value of the second installation package, determining that the composite package is successfully verified;
若所述合成包的校验值与所述第二安装包的校验值不同,则确定所述合成包校验失败。If the check value of the composite package is different from the check value of the second installation package, it is determined that the composite package fails the check.
其中,获取合成包的校验值和第二安装包的校验值时所使用的校验算法相同。Wherein, the check value of the composite package is the same as the check algorithm used when the check value of the second installation package is obtained.
可选的,在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段之后,本申请实施例还包括:Optionally, after inserting a decompression control field, a compression control field, and a copy control field in the incremental packet, the embodiment of the present application further includes:
将所述增量包上传至指定设备。Upload the incremental package to the designated device.
在本申请实施例中,在增量包的合成包校验成功,并将解压控制字段、压缩控制字段以及拷贝控制字段插入到增量包之后,可以将增量包上传至指定设备,以便于移动终端从指定设备中获取增量包,并根据增量包中的控制字段实现在新安装包合成过程中的多线程压缩、解压以及拷贝,提高新安装包的合成速度。In the embodiment of the present application, after the synthetic package verification of the incremental package succeeds, and the decompression control field, the compression control field, and the copy control field are inserted into the incremental package, the incremental package can be uploaded to the designated device to facilitate The mobile terminal obtains the incremental package from the designated device, and implements multi-thread compression, decompression and copying during the synthesis of the new installation package according to the control field in the incremental package, thereby improving the synthesis speed of the new installation package.
本申请实施例通过获取服务器中存储的应用程序的新旧安装包中待解压文件和待 拷贝文件,可以获得增量包以及解压控制字段、压缩控制字段以及拷贝控制字段,将这些字段插入到增量包中,可以便于移动终端在新安装包合成过程中进行多线程的压缩、解压以及拷贝,提高新安装包的合成速度。In this embodiment of the application, by obtaining the files to be decompressed and the files to be copied in the old and new installation packages of the application stored in the server, the incremental package and the decompression control field, the compression control field, and the copy control field can be obtained, and these fields are inserted into the incremental In the package, it is convenient for the mobile terminal to perform multi-threaded compression, decompression and copying during the synthesis of the new installation package, thereby improving the synthesis speed of the new installation package.
参见图3,是本申请实施例三提供的文件处理装置的结构示意图,该文件处理装置可集成于移动终端中。为了便于说明,仅示出了与本申请实施例相关的部分。Refer to FIG. 3, which is a schematic structural diagram of a file processing device provided in Embodiment 3 of the present application. The file processing device can be integrated in a mobile terminal. For ease of description, only the parts related to the embodiments of the present application are shown.
所述文件处理装置包括:The file processing device includes:
增量包获取模块31,用于获取应用程序的增量包,其中,所述增量包包括解压控制字段、压缩控制字段以及拷贝控制字段;The incremental package acquisition module 31 is configured to acquire the incremental package of the application program, where the incremental package includes a decompression control field, a compression control field, and a copy control field;
增量文件获取模块32,用于对所述增量包进行解压,获得增量文件;The incremental file obtaining module 32 is configured to decompress the incremental package to obtain an incremental file;
第一安装包获取模块33,用于获取所述应用程序的第一安装包;The first installation package obtaining module 33 is configured to obtain the first installation package of the application program;
第一安装包解压模块34,用于根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中的待解压文件进行解压,解压到第一目标文件;The first installation package decompression module 34 is configured to decompress the file to be decompressed in the first installation package by using multiple threads according to the decompression control field in the incremental package, and decompress it to a first target file;
第二目标文件获得模块35,用于将所述增量文件与所述第一目标文件进行合成,获得第二目标文件;The second target file obtaining module 35 is configured to synthesize the incremental file with the first target file to obtain a second target file;
第二目标文件压缩模块36,用于根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件;The second target file compression module 36 is configured to use multiple threads to compress the second target file according to the compression control field in the incremental packet, and compress it to a designated file;
文件拷贝模块37,用于根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件,包括所述待拷贝文件和压缩后的所述第二目标文件的指定文件为第二安装包。The file copy module 37 is configured to copy the file to be copied in the first installation package to the designated file according to the copy control field in the incremental package, including the file to be copied and the compressed file The designated file of the second target file is the second installation package.
可选的,一组解压控制字段记录所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在第一目标文件中的起始位置和结束位置,所述第一安装包解压模块34具体用于:Optionally, a group of decompression control fields records the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression, so The first installation package decompression module 34 is specifically used for:
在所述增量包中包括多组解压控制字段时,根据所述多组解压控制字段记录的所述第一安装包中多个待解压文件的起始位置和结束位置,获取所述第一安装包中多个待解压文件;When the delta package includes multiple sets of decompression control fields, the first set of decompression control fields records the start position and end position of the multiple files to be decompressed in the first installation package. Multiple files to be decompressed in the installation package;
将所述多个待解压文件的解压任务分配到多个线程;Allocating the decompression tasks of the multiple files to be decompressed to multiple threads;
使用所述多个线程对所述多个待解压文件进行解压,并将解压后的所述多个待解压文件存储到所述第一目标文件中指定位置,其中,所述第一目标文件中指定位置是由所述多组解压控制字段记录的所述多个待解压文件解压后在所述第一目标文件中的起始位置和结束位置确定的。Use the multiple threads to decompress the multiple files to be decompressed, and store the multiple files to be decompressed after decompression in a specified location in the first target file, where the first target file The designated position is determined by the start position and the end position of the plurality of files to be decompressed recorded in the plurality of sets of decompression control fields in the first target file after decompression.
可选的,一组压缩控制字段记录所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置,第二目标文件压缩模块36具体用于:Optionally, a group of compression control fields records the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after compression , The second target file compression module 36 is specifically used for:
在所述增量包中包括多组压缩控制字段时,根据所述多组压缩控制字段记录的所述第二目标文件中多个待压缩文件的起始位置和结束位置,获取所述第二目标文件中多个待压缩文件;When the incremental packet includes multiple sets of compression control fields, the second target file is recorded according to the start positions and end positions of the multiple files to be compressed in the second target file recorded by the multiple sets of compression control fields. Multiple files to be compressed in the target file;
将所述多个待压缩文件的压缩任务分配到多个线程;Allocating the compression tasks of the multiple files to be compressed to multiple threads;
使用所述多个线程对所述多个待压缩文件进行压缩,并将压缩后的所述多个待压缩文件存储到所述指定文件中第一指定位置,其中,所述指定文件中第一指定位置是由所述多组压缩控制字段记录的所述多个待压缩文件在所述第二安装包中的起始位置和结束位置确定的。The multiple threads are used to compress the multiple files to be compressed, and the multiple compressed files to be compressed are stored in a first specified location in the specified file, where the first specified file is The designated position is determined by the start position and the end position of the plurality of files to be compressed recorded in the plurality of sets of compression control fields in the second installation package.
可选的,一组拷贝控制字段记录一个待拷贝文件在所述第一安装包中起始位置和结束位置以及在所述第二安装包中的起始位置和结束位置,所述文件拷贝模块47具体用于:Optionally, a group of copy control fields records the start position and end position of a file to be copied in the first installation package and the start position and end position in the second installation package, the file copy module 47 is specifically used for:
在所述增量包中包括多组拷贝控制字段时,根据所述多组拷贝控制字段记录的多 个待拷贝文件在所述第一安装包中的起始位置和结束位置,获取所述第一安装包中多个待拷贝文件;When multiple sets of copy control fields are included in the delta package, the first installation package is obtained according to the start positions and end positions of the multiple files to be copied recorded in the multiple sets of copy control fields in the first installation package. Multiple files to be copied in one installation package;
将所述多个待拷贝文件的拷贝任务分配到多个线程;Allocating the copy tasks of the multiple files to be copied to multiple threads;
使用所述多个线程将所述多个待拷贝文件拷贝到所述指定文件中第二指定位置,其中,所述指定文件中第二指定位置是由所述多组拷贝控制字段记录的所述多个待拷贝文件在所述第二安装包中的起始位置和结束位置确定的。Use the multiple threads to copy the multiple files to be copied to a second specified location in the specified file, wherein the second specified location in the specified file is the set of copy control fields recorded by the multiple copy control fields. The start position and end position of the multiple files to be copied in the second installation package are determined.
可选的,所述文件处理装置还包括:Optionally, the file processing device further includes:
安装模块,用于安装所述第二安装包;An installation module for installing the second installation package;
安装包校验模块,用于对所述第二安装包进行校验;The installation package verification module is used to verify the second installation package;
相应的,所述安装模块具体用于:Correspondingly, the installation module is specifically used for:
若所述第二安装包校验成功,则安装所述第二安装包。If the verification of the second installation package is successful, the second installation package is installed.
可选的,所述安装包校验模块具体用于:Optionally, the installation package verification module is specifically used for:
获取所述第二安装包的实际校验值;Obtaining the actual check value of the second installation package;
从指定设备或者所述增量包中获取所述第二安装包的目标校验值;Obtaining the target check value of the second installation package from a designated device or the incremental package;
若所述第二安装包的实际校验值与所述第二安装包的目标校验值相同,则确定所述第二安装包校验成功;If the actual verification value of the second installation package is the same as the target verification value of the second installation package, it is determined that the verification of the second installation package is successful;
若所述第二安装包的实际校验值与所述第二安装包的目标校验值不同,则确定所述第二安装包校验失败。If the actual verification value of the second installation package is different from the target verification value of the second installation package, it is determined that the verification of the second installation package fails.
可选的,所述文件处理装置还包括:Optionally, the file processing device further includes:
第二安装包获取模块,用于若所述第二安装包校验失败,则从指定设备中获取所述应用程序的第二安装包。The second installation package obtaining module is configured to obtain the second installation package of the application program from the designated device if the verification of the second installation package fails.
可选的,所述文件处理装置还包括:Optionally, the file processing device further includes:
增量包校验模块,用于对所述增量包进行校验。The incremental package verification module is used to verify the incremental package.
可选的,所述增量文件获取模块32具体用于:Optionally, the incremental file obtaining module 32 is specifically configured to:
若所述增量包校验成功,则对所述增量包进行解压,获得所述增量文件。If the verification of the incremental package succeeds, the incremental package is decompressed to obtain the incremental file.
可选的,所述增量包校验模块具体用于:Optionally, the incremental packet verification module is specifically configured to:
获取所述增量包的实际校验值;Obtaining the actual check value of the incremental package;
从指定设备或者增量包中获取所述增量包的目标校验值;Obtaining the target check value of the incremental package from a designated device or incremental package;
若所述增量包的实际校验值与所述增量包的目标校验值相同,则确定所述增量包校验成功;If the actual check value of the incremental package is the same as the target check value of the incremental package, determining that the incremental package is successfully verified;
若所述增量包的实际校验值与所述增量包的目标校验值不同,则确定所述增量包校验失败。If the actual check value of the incremental package is different from the target check value of the incremental package, it is determined that the incremental package fails to be verified.
本申请实施例提供的文件处理装置可以应用在前述实施例一中,详情参见上述实施例一的描述,在此不再赘述。The file processing apparatus provided in the embodiment of the present application can be applied in the foregoing embodiment 1. For details, refer to the description of the foregoing embodiment 1, and details are not described herein again.
参见图4,是本申请实施例四提供的文件处理装置的结构示意图,该文件处理装置可集成于服务器中。为了便于说明,仅示出了与本申请实施例相关的部分。Refer to FIG. 4, which is a schematic structural diagram of a file processing device provided in Embodiment 4 of the present application. The file processing device can be integrated in a server. For ease of description, only the parts related to the embodiments of the present application are shown.
所述文件处理装置包括:The file processing device includes:
待处理文件获取模块41,用于获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包中与所述第二安装包中的待拷贝文件,其中,待拷贝文件是指所述第一安装包中和所述第二安装包中不存在差异的文件;The to-be-processed file acquisition module 41 is used to acquire the files to be decompressed in the first installation package of the application, the files to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package Files, where the files to be copied refer to files in the first installation package that are not different from those in the second installation package;
第一位置获取模块42,用于获取所述第一安装包中待解压文件的起始位置和结束位置,所述待拷贝文件在所述第一安装包中的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置,以及所述待拷贝文件在所述第二安装包中的起始位置和结束位置;The first location obtaining module 42 is configured to obtain the start position and the end position of the file to be decompressed in the first installation package, the start position and the end position of the file to be copied in the first installation package, and The start position and end position of the file to be decompressed in the second installation package, and the start position and end position of the file to be copied in the second installation package;
文件解压模块43,用于解压所述第一安装包中待解压文件和所述第二安装包中待 解压文件,将所述第一安装包中待解压文件解压到第一目标文件,将所述第二安装包中待解压文件解压到第二目标文件;The file decompression module 43 is configured to decompress the files to be decompressed in the first installation package and the files to be decompressed in the second installation package, decompress the files to be decompressed in the first installation package to a first target file, and decompress all files to be decompressed in the first installation package. The file to be decompressed in the second installation package is decompressed to a second target file;
第二位置获取模块44,用于获取所述第一安装包中待解压文件解压后在所述第一目标文件中的起始位置和结束位置,以及所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置,其中,所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置是指所述第二目标文件中待压缩文件的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置是指所述第二目标文件中待压缩文件压缩后在所述第二安装包中的起始位置和结束位置;The second position obtaining module 44 is configured to obtain the start position and the end position of the file to be decompressed in the first installation package after being decompressed in the first target file, and the file to be decompressed in the second installation package is decompressed And the start position and end position in the second target file, where the start position and end position in the second target file after the file to be decompressed in the second installation package is decompressed refer to the The start position and end position of the file to be compressed in the second target file. The start position and end position of the file to be decompressed in the second installation package refer to the file to be compressed in the second target file after being compressed. The start position and end position in the second installation package;
第一位置记录模块45,用于将所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在所述第一目标文件中的起始位置和结束位置记录在一组解压控制字段中;The first position recording module 45 is used to record the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression Recorded in a set of decompression control fields;
第二位置记录模块46,用于将所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置记录在一组压缩控制字段中;The second position recording module 46 is configured to record the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after compression Recorded in a set of compression control fields;
第三位置记录模块47,用于将一个待拷贝文件在所述第一安装包中的起始位置和结束位置,以及在所述第二安装包中的起始位置和结束位置记录在一组拷贝控制字段中;The third position recording module 47 is used to record the starting position and ending position of a file to be copied in the first installation package, and the starting position and ending position in the second installation package in a group In the copy control field;
差分处理模块48,用于根据预设差分算法,获取所述第一目标文件中解压后的待解压文件与所述第二目标文件中解压后的待解压文件的增量文件;The difference processing module 48 is configured to obtain, according to a preset difference algorithm, the file to be decompressed after decompression in the first target file and the incremental file of the file to be decompressed after decompression in the second target file;
增量包处理模块49,用于压缩所述增量文件,获得增量包,并在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。The incremental package processing module 49 is configured to compress the incremental file to obtain an incremental package, and insert a decompression control field, a compression control field, and a copy control field into the incremental package.
可选的,所述待处理文件获取模块41具体用于:Optionally, the to-be-processed file obtaining module 41 is specifically configured to:
遍历所述应用程序的第一安装包中文件和第二安装包中文件,获取所述第一安装包中每个文件的校验值以及所述第二安装包中每个文件的校验值;Traverse the files in the first installation package and the files in the second installation package of the application to obtain the check value of each file in the first installation package and the check value of each file in the second installation package ;
获取所述第一安装包中校验值与所述第二安装包中校验值相同的文件,确定该文件为待拷贝文件;Acquiring a file with the same check value in the first installation package as the check value in the second installation package, and determining that the file is a file to be copied;
确定所述第一安装包中除所述待拷贝文件之外的文件为所述第一安装包中待解压文件,所述第二安装包中除所述待拷贝文件之外的文件为所述第二安装包中待解压文件。It is determined that the files in the first installation package other than the files to be copied are the files to be decompressed in the first installation package, and the files in the second installation package other than the files to be copied are the Files to be decompressed in the second installation package.
可选的,所述增量包处理模块49具体用于:Optionally, the incremental packet processing module 49 is specifically configured to:
将所述增量包与所述第一安装包进行合成,获得合成包;Synthesize the incremental package and the first installation package to obtain a composite package;
对所述合成包进行校验;Verifying the synthetic package;
若所述合成包校验成功,则在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。If the composite packet is successfully verified, insert a decompression control field, a compression control field, and a copy control field in the incremental packet.
可选的,所述增量包处理模块49具体用于:Optionally, the incremental packet processing module 49 is specifically configured to:
获取所述合成包的校验值;Obtaining the check value of the synthetic package;
获取所述第二安装包的校验值;Acquiring the check value of the second installation package;
若所述合成包的校验值与所述第二安装包的校验值相同,则确定所述合成包校验成功;If the check value of the composite package is the same as the check value of the second installation package, determining that the composite package is successfully verified;
若所述合成包的校验值与所述第二安装包的校验值不同,则确定所述合成包校验失败。If the check value of the composite package is different from the check value of the second installation package, it is determined that the composite package fails the check.
可选的,所述文件处理装置还包括:Optionally, the file processing device further includes:
增量包上传模块,用于将所述增量包上传至指定设备。The incremental package upload module is used to upload the incremental package to a designated device.
本申请实施例提供的文件处理装置可以应用在前述实施例二中,详情参见上述实施例二的描述,在此不再赘述。The file processing apparatus provided in the embodiment of the present application can be applied in the foregoing embodiment 2. For details, refer to the description of the foregoing embodiment 2, and details are not repeated here.
图5是本申请实施例五提供的移动终端的结构示意图。如图所示的该移动终端可以包括:一个或多个处理器501(图中仅示出一个);一个或多个输入设备502(图中仅示出一个),一个或多个输出设备503(图中仅示出一个)和存储器504。上述处理器501、输入设备502、输出设备503和存储器504通过总线505连接。存储器504用于存储指令,处理器501执行存储器504存储的指令时实现上述实施例一中文件处理方法的步骤。FIG. 5 is a schematic structural diagram of a mobile terminal provided in Embodiment 5 of the present application. The mobile terminal as shown in the figure may include: one or more processors 501 (only one is shown in the figure); one or more input devices 502 (only one is shown in the figure), and one or more output devices 503 (Only one is shown in the figure) and a memory 504. The aforementioned processor 501, input device 502, output device 503, and memory 504 are connected via a bus 505. The memory 504 is used to store instructions, and the processor 501 implements the steps of the file processing method in the first embodiment when the processor 501 executes the instructions stored in the memory 504.
上述移动终端可以是手机、笔记本、掌上电脑、桌上型计算机等设备。The above-mentioned mobile terminal may be a mobile phone, a notebook, a palmtop computer, a desktop computer, and other devices.
应当理解,在本申请实施例中,所述处理器501可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 501 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors or digital signal processors (Digital Signal Processors, DSPs). , Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
输入设备502可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风、数据接收接口等。输出设备503可以包括显示器(LCD等)、扬声器、数据发送接口等。The input device 502 may include a touch panel, a fingerprint sensor (used to collect the user's fingerprint information and fingerprint orientation information), a microphone, a data receiving interface, and the like. The output device 503 may include a display (LCD, etc.), a speaker, a data transmission interface, and the like.
该存储器504可以包括只读存储器和随机存取存储器,并向处理器501提供指令和数据。存储器504的一部分还可以包括非易失性随机存取存储器。例如,存储器504还可以存储设备类型的信息。The memory 504 may include a read-only memory and a random access memory, and provides instructions and data to the processor 501. A part of the memory 504 may also include a non-volatile random access memory. For example, the memory 504 may also store device type information.
具体实现中,本申请实施例中所描述的处理器501、输入设备502、输出设备503和存储器504可执行本申请实施例一提供的文件处理方法的实施例中所描述的实现方式,也可执行实施例三所述文件处理装置中所描述的实现方式,在此不再赘述。In specific implementation, the processor 501, input device 502, output device 503, and memory 504 described in the embodiment of this application can execute the implementation described in the embodiment of the file processing method provided in the first embodiment of this application, or The implementation manner described in the file processing apparatus described in the third embodiment is executed, and details are not described herein again.
图6是本申请实施例六提供的服务器的结构示意图。如图所示的该服务器可以包括:一个或多个处理器601(图中仅示出一个);一个或多个输入设备602(图中仅示出一个),一个或多个输出设备603(图中仅示出一个)和存储器604。上述处理器601、输入设备602、输出设备603和存储器604通过总线605连接。存储器604用于存储指令,处理器601执行存储器604存储的指令时实现上述实施例二中文件处理方法的步骤。FIG. 6 is a schematic diagram of the structure of a server provided in Embodiment 6 of the present application. The server as shown in the figure may include: one or more processors 601 (only one is shown in the figure); one or more input devices 602 (only one is shown in the figure), and one or more output devices 603 ( Only one) and memory 604 are shown in the figure. The aforementioned processor 601, input device 602, output device 603, and memory 604 are connected via a bus 605. The memory 604 is used to store instructions, and the processor 601 implements the steps of the file processing method in the second embodiment when the processor 601 executes the instructions stored in the memory 604.
上述服务器可以是用于计算或存储资源的云端服务器。The aforementioned server may be a cloud server used for computing or storing resources.
应当理解,在本申请实施例中,所述处理器601可以是中央处理单元CPU,还可以是其他通用处理器、数字信号处理器DSP、专用集成电路ASIC、现成可编程门阵列FPGA或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 601 may be a central processing unit CPU, or other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, ready-made programmable gate array FPGAs, or other programmable gate arrays. Programming logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
输入设备602可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风、数据接收接口等。输出设备603可以包括显示器(LCD等)、扬声器、数据发送接口等。The input device 602 may include a touch panel, a fingerprint sensor (used to collect the user's fingerprint information and fingerprint orientation information), a microphone, a data receiving interface, and the like. The output device 603 may include a display (LCD, etc.), a speaker, a data transmission interface, and the like.
该存储器604可以包括只读存储器和随机存取存储器,并向处理器601提供指令和数据。存储器604的一部分还可以包括非易失性随机存取存储器。例如,存储器604还可以存储设备类型的信息。The memory 604 may include a read-only memory and a random access memory, and provides instructions and data to the processor 601. A part of the memory 604 may also include a non-volatile random access memory. For example, the memory 604 may also store device type information.
具体实现中,本申请实施例中所描述的处理器601、输入设备602、输出设备603和存储器604可执行本申请实施例二提供的文件处理方法的实施例中所描述的实现方式,也可执行实施例四所述文件处理装置中所描述的实现方式,在此不再赘述。In specific implementation, the processor 601, input device 602, output device 603, and memory 604 described in the embodiment of this application can execute the implementation described in the embodiment of the file processing method provided in the second embodiment of this application, or The implementation manner described in the file processing apparatus described in the fourth embodiment is executed, and details are not described herein again.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块, 以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed. Module completion, that is, divide the internal structure of the device into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist alone physically, or two or more units can be integrated into one unit. The above-mentioned integrated units can be hardware-based Formal realization can also be realized in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed device and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be divided. It can be combined or integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。If the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the program is executed by the processor, it can implement the steps of the foregoing method embodiments. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electrical carrier signal, telecommunications signal, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or deleted according to the requirements of the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to the legislation and patent practice, the computer-readable medium Does not include electrical carrier signals and telecommunication signals.
本申请实现上述实施例方法中的全部或部分流程,也可以通过一种计算机程序产品来完成,当所述计算机程序产品在移动终端上运行时,使得所述移动终端执行时实现可实现上述各个方法实施例中的步骤。This application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by a computer program product. When the computer program product runs on a mobile terminal, the implementation of the mobile terminal can realize each of the above Steps in the method embodiment.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that it can still implement the foregoing The technical solutions recorded in the examples are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in Within the scope of protection of this application.

Claims (20)

  1. 一种文件处理方法,其特征在于,所述文件处理方法包括:A file processing method, characterized in that the file processing method includes:
    获取应用程序的增量包,其中,所述增量包包括解压控制字段、压缩控制字段以及拷贝控制字段;Acquiring an incremental package of the application, where the incremental package includes a decompression control field, a compression control field, and a copy control field;
    对所述增量包进行解压,获得增量文件;Decompress the incremental package to obtain an incremental file;
    获取所述应用程序的第一安装包;Obtaining the first installation package of the application;
    根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中的待解压文件进行解压,解压到第一目标文件;According to the decompression control field in the incremental package, use multiple threads to decompress the file to be decompressed in the first installation package, and decompress it to a first target file;
    将所述增量文件与所述第一目标文件进行合成,获得第二目标文件;Synthesize the incremental file with the first target file to obtain a second target file;
    根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件;According to the compression control field in the delta packet, compress the second target file using multiple threads, and compress it to a designated file;
    根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件,包括所述待拷贝文件和压缩后的所述第二目标文件的指定文件为第二安装包。According to the copy control field in the incremental package, copy the file to be copied in the first installation package to the designated file, including the designated file of the file to be copied and the compressed second target file It is the second installation package.
  2. 如权利要求1所述的文件处理方法,其特征在于,一组解压控制字段记录所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在第一目标文件中的起始位置和结束位置,所述根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中待解压文件进行解压,解压到第一目标文件包括:The file processing method according to claim 1, wherein a set of decompression control fields records the start position and end position of a file to be decompressed in the first installation package and the file to be decompressed in the first target after decompression. The start position and the end position in the file, the decompressing the file to be decompressed in the first installation package using multithreading according to the decompression control field in the increment package, and decompressing to the first target file includes:
    在所述增量包中包括多组解压控制字段时,根据所述多组解压控制字段记录的所述第一安装包中多个待解压文件的起始位置和结束位置,获取所述第一安装包中多个待解压文件;When the delta package includes multiple sets of decompression control fields, the first set of decompression control fields records the start position and end position of the multiple files to be decompressed in the first installation package. Multiple files to be decompressed in the installation package;
    将所述多个待解压文件的解压任务分配到多个线程;Allocating the decompression tasks of the multiple files to be decompressed to multiple threads;
    使用所述多个线程对所述多个待解压文件进行解压,并将解压后的所述多个待解压文件存储到所述第一目标文件中指定位置,其中,所述第一目标文件中指定位置是由所述多组解压控制字段记录的所述多个待解压文件解压后在所述第一目标文件中的起始位置和结束位置确定的。Use the multiple threads to decompress the multiple files to be decompressed, and store the multiple files to be decompressed after decompression in a specified location in the first target file, where the first target file The designated position is determined by the start position and the end position of the plurality of files to be decompressed recorded in the plurality of sets of decompression control fields in the first target file after decompression.
  3. 如权利要求1所述的文件处理方法,其特征在于,一组压缩控制字段记录所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置,所述根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件包括:The file processing method according to claim 1, wherein a group of compression control fields records the start position and end position of a file to be compressed in the second target file, and the file to be compressed is compressed in the first 2. The start position and the end position in the installation package, the said second target file is compressed by multithreading according to the compression control field in the said increment package, and compressed to the designated file includes:
    在所述增量包中包括多组压缩控制字段时,根据所述多组压缩控制字段记录的所述第二目标文件中多个待压缩文件的起始位置和结束位置,获取所述第二目标文件中多个待压缩文件;When the incremental packet includes multiple sets of compression control fields, the second target file is recorded according to the start positions and end positions of the multiple files to be compressed in the second target file recorded by the multiple sets of compression control fields. Multiple files to be compressed in the target file;
    将所述多个待压缩文件的压缩任务分配到多个线程;Allocating the compression tasks of the multiple files to be compressed to multiple threads;
    使用所述多个线程对所述多个待压缩文件进行压缩,并将压缩后的所述多个待压缩文件存储到所述指定文件中第一指定位置,其中,所述指定文件中第一指定位置是由所述多组压缩控制字段记录的所述多个待压缩文件在所述第二安装包中的起始位置和结束位置确定的。The multiple threads are used to compress the multiple files to be compressed, and the multiple compressed files to be compressed are stored in a first specified location in the specified file, where the first specified file is The designated position is determined by the start position and the end position of the plurality of files to be compressed recorded in the plurality of sets of compression control fields in the second installation package.
  4. 如权利要求1所述的文件处理方法,其特征在于,一组拷贝控制字段记录一个待拷贝文件在所述第一安装包中起始位置和结束位置以及在所述第二安装包中的起始位置和结束位置,所述根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件包括:The file processing method according to claim 1, wherein a set of copy control fields records the start position and end position of a file to be copied in the first installation package and the start position in the second installation package. Starting position and ending position, the copying the file to be copied in the first installation package to the designated file according to the copy control field in the incremental package includes:
    在所述增量包中包括多组拷贝控制字段时,根据所述多组拷贝控制字段记录的多个待拷贝文件在所述第一安装包中的起始位置和结束位置,获取所述第一安装包中多个待拷贝文件;When multiple sets of copy control fields are included in the delta package, the first installation package is obtained according to the start positions and end positions of the multiple files to be copied recorded in the multiple sets of copy control fields in the first installation package. Multiple files to be copied in one installation package;
    将所述多个待拷贝文件的拷贝任务分配到多个线程;Allocating the copy tasks of the multiple files to be copied to multiple threads;
    使用所述多个线程将所述多个待拷贝文件拷贝到所述指定文件中第二指定位置,其中,所述指定文件中第二指定位置是由所述多组拷贝控制字段记录的所述多个待拷贝文件在所述第二安装包中的起始位置和结束位置确定的。Use the multiple threads to copy the multiple files to be copied to a second specified location in the specified file, wherein the second specified location in the specified file is the set of copy control fields recorded by the multiple copy control fields. The start position and end position of the multiple files to be copied in the second installation package are determined.
  5. 如权利要求1所述的文件处理方法,其特征在于,还包括:5. The file processing method according to claim 1, further comprising:
    安装所述第二安装包。Install the second installation package.
  6. 如权利要求5所述的文件处理方法,其特征在于,在安装所述第二安装包之前,还包括:5. The file processing method according to claim 5, wherein before installing the second installation package, further comprising:
    对所述第二安装包进行校验;Verifying the second installation package;
    相应的,所述安装所述第二安装包包括:Correspondingly, the installing the second installation package includes:
    若所述第二安装包校验成功,则安装所述第二安装包。If the verification of the second installation package is successful, the second installation package is installed.
  7. 如权利要求6所述的文件处理方法,其特征在于,所述对所述第二安装包进行校验包括:7. The file processing method according to claim 6, wherein said verifying said second installation package comprises:
    获取所述第二安装包的实际校验值;Obtaining the actual check value of the second installation package;
    从指定设备或者所述增量包中获取所述第二安装包的目标校验值;Obtaining the target check value of the second installation package from a designated device or the incremental package;
    若所述第二安装包的实际校验值与所述第二安装包的目标校验值相同,则确定所述第二安装包校验成功;If the actual verification value of the second installation package is the same as the target verification value of the second installation package, it is determined that the verification of the second installation package is successful;
    若所述第二安装包的实际校验值与所述第二安装包的目标校验值不同,则确定所述第二安装包校验失败。If the actual verification value of the second installation package is different from the target verification value of the second installation package, it is determined that the verification of the second installation package fails.
  8. 如权利要求6所述的文件处理方法,其特征在于,还包括:8. The file processing method of claim 6, further comprising:
    若所述第二安装包校验失败,则从指定设备中获取所述应用程序的第二安装包。If the verification of the second installation package fails, the second installation package of the application program is obtained from the designated device.
  9. 如权利要求1至8任一项所述的文件处理方法,其特征在于,在获取应用程序的增量包之后,还包括:The file processing method according to any one of claims 1 to 8, wherein after obtaining the incremental package of the application program, the method further comprises:
    对所述增量包进行校验;Verifying the incremental package;
    相应的,所述对所述增量包进行解压,获得增量文件包括:Correspondingly, the decompressing the incremental package to obtain the incremental file includes:
    若所述增量包校验成功,则对所述增量包进行解压,获得所述增量文件。If the verification of the incremental package succeeds, the incremental package is decompressed to obtain the incremental file.
  10. 如权利要求9所述的文件处理方法,其特征在于,所述对所述增量包进行校验包括:9. The file processing method according to claim 9, wherein said verifying said incremental package comprises:
    获取所述增量包的实际校验值;Obtaining the actual check value of the incremental package;
    从指定设备或者增量包中获取所述增量包的目标校验值;Obtaining the target check value of the incremental package from a designated device or incremental package;
    若所述增量包的实际校验值与所述增量包的目标校验值相同,则确定所述增量包校验成功;If the actual check value of the incremental package is the same as the target check value of the incremental package, determining that the incremental package is successfully verified;
    若所述增量包的实际校验值与所述增量包的目标校验值不同,则确定所述增量包校验失败。If the actual check value of the incremental package is different from the target check value of the incremental package, it is determined that the incremental package fails to be verified.
  11. 一种文件处理方法,其特征在于,所述文件处理方法包括:A file processing method, characterized in that the file processing method includes:
    获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包中和所述第二安装包中的待拷贝文件,其中,待拷贝文件是指所述第一安装包中和所述第二安装包中不存在差异的文件;Obtain the files to be decompressed in the first installation package of the application, the files to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package, where the files to be copied refer to Files in the first installation package that are not different from those in the second installation package;
    获取所述第一安装包中待解压文件的起始位置和结束位置,所述待拷贝文件在所述第一安装包中的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置,以及所述待拷贝文件在所述第二安装包中的起始位置和结束位置;Acquire the start position and end position of the file to be decompressed in the first installation package, the start position and end position of the file to be copied in the first installation package, and the file to be decompressed in the second installation package The starting position and ending position of the file, and the starting position and ending position of the file to be copied in the second installation package;
    解压所述第一安装包中待解压文件和所述第二安装包中待解压文件,将所述第一安装包中待解压文件解压到第一目标文件,将所述第二安装包中待解压文件解压到第二目标文件;Decompress the files to be decompressed in the first installation package and the files to be decompressed in the second installation package, decompress the files to be decompressed in the first installation package to a first target file, and extract the files to be decompressed in the second installation package Decompress the decompressed file to the second target file;
    获取所述第一安装包中待解压文件解压后在所述第一目标文件中的起始位置和结束位置,以及所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置,其中,所述第二安装包中待解压文件解压后在所述第二目标文件中的起 始位置和结束位置是指所述第二目标文件中待压缩文件的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置是指所述第二目标文件中待压缩文件压缩后在所述第二安装包中的起始位置和结束位置;Obtain the start position and the end position of the file to be decompressed in the first installation package in the first target file after decompression, and the file to be decompressed in the second installation package in the second target file after decompression The start position and the end position of the file to be decompressed in the second installation package after decompression in the second target file refer to the file to be compressed in the second target file Start position and end position, the start position and end position of the file to be decompressed in the second installation package refer to the start position of the file to be compressed in the second target file in the second installation package after compression And end position;
    将所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在所述第一目标文件中的起始位置和结束位置记录在一组解压控制字段中;Recording the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression in a set of decompression control fields;
    将所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置记录在一组压缩控制字段中;Recording the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after being compressed in a group of compression control fields;
    将一个待拷贝文件在所述第一安装包中的起始位置和结束位置,以及在所述第二安装包中的起始位置和结束位置记录在一组拷贝控制字段中;Recording the start position and end position of a file to be copied in the first installation package, and the start position and end position in the second installation package in a set of copy control fields;
    根据预设差分算法,获取所述第一目标文件中解压后的待解压文件与所述第二目标文件中解压后的待解压文件的增量文件;Obtaining, according to a preset difference algorithm, an incremental file of the file to be decompressed after decompression in the first target file and the file to be decompressed after decompression in the second target file;
    压缩所述增量文件,获得增量包,并在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。Compress the incremental file to obtain an incremental package, and insert a decompression control field, a compression control field, and a copy control field in the incremental package.
  12. 如权利要求11所述的文件处理方法,其特征在于,所述获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包和所述第二安装包中的待拷贝文件包括:The file processing method according to claim 11, wherein the file to be decompressed in the first installation package of the obtained application, the file to be decompressed in the second installation package, and the first installation package and the first installation package are obtained. 2. The files to be copied in the installation package include:
    遍历所述应用程序的第一安装包中文件和第二安装包中文件,获取所述第一安装包中每个文件的校验值以及所述第二安装包中每个文件的校验值;Traverse the files in the first installation package and the files in the second installation package of the application to obtain the check value of each file in the first installation package and the check value of each file in the second installation package ;
    获取所述第一安装包中校验值与所述第二安装包中校验值相同的文件,确定该文件为待拷贝文件;Acquiring a file with the same check value in the first installation package as the check value in the second installation package, and determining that the file is a file to be copied;
    确定所述第一安装包中除所述待拷贝文件之外的文件为所述第一安装包中待解压文件,所述第二安装包中除所述待拷贝文件之外的文件为所述第二安装包中待解压文件。It is determined that the files in the first installation package other than the files to be copied are the files to be decompressed in the first installation package, and the files in the second installation package other than the files to be copied are the Files to be decompressed in the second installation package.
  13. 如权利要求11所述的文件处理方法,其特征在于,在获得增量包之后,还包括:The file processing method according to claim 11, wherein after obtaining the incremental package, the method further comprises:
    将所述增量包与所述第一安装包进行合成,获得合成包;Synthesize the incremental package and the first installation package to obtain a composite package;
    对所述合成包进行校验;Verifying the synthetic package;
    相应的,所述在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段包括:Correspondingly, inserting a decompression control field, a compression control field, and a copy control field in the incremental packet includes:
    若所述合成包校验成功,则在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。If the composite packet is successfully verified, insert a decompression control field, a compression control field, and a copy control field in the incremental packet.
  14. 如权利要求13所述的文件处理方法,其特征在于,所述对所述合成包进行校验包括:15. The file processing method according to claim 13, wherein said verifying said composite package comprises:
    获取所述合成包的校验值;Obtaining the check value of the synthetic package;
    获取所述第二安装包的校验值;Acquiring the check value of the second installation package;
    若所述合成包的校验值与所述第二安装包的校验值相同,则确定所述合成包校验成功;If the check value of the composite package is the same as the check value of the second installation package, determining that the composite package is successfully verified;
    若所述合成包的校验值与所述第二安装包的校验值不同,则确定所述合成包校验失败。If the check value of the composite package is different from the check value of the second installation package, it is determined that the composite package fails the check.
  15. 如权利要求11至14任一项所述的文件处理方法,其特征在于,在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段之后,还包括:The file processing method according to any one of claims 11 to 14, wherein after inserting a decompression control field, a compression control field, and a copy control field in the incremental packet, the method further comprises:
    将所述增量包上传至指定设备。Upload the incremental package to the designated device.
  16. 一种文件处理装置,其特征在于,所述文件处理装置包括:A file processing device, characterized in that, the file processing device includes:
    增量包获取模块,用于获取应用程序的增量包,其中,所述增量包包括解压控制字段、压缩控制字段以及拷贝控制字段;An incremental package acquisition module for acquiring an incremental package of an application program, where the incremental package includes a decompression control field, a compression control field, and a copy control field;
    增量文件获取模块,用于对所述增量包进行解压,获得增量文件;An incremental file obtaining module, used to decompress the incremental package to obtain an incremental file;
    第一安装包获取模块,用于获取所述应用程序的第一安装包;The first installation package obtaining module is used to obtain the first installation package of the application program;
    第一安装包解压模块,用于根据所述增量包中的解压控制字段,使用多线程对所述第一安装包中的待解压文件进行解压,解压到第一目标文件;The first installation package decompression module is configured to decompress the file to be decompressed in the first installation package using multithreading according to the decompression control field in the incremental package, and decompress it to a first target file;
    第二目标文件获得模块,用于将所述增量文件与所述第一目标文件进行合成,获得第二目标文件;The second target file obtaining module is configured to synthesize the incremental file with the first target file to obtain a second target file;
    第二目标文件压缩模块,用于根据所述增量包中的压缩控制字段,使用多线程对所述第二目标文件进行压缩,压缩到指定文件;The second target file compression module is configured to compress the second target file by using multiple threads according to the compression control field in the incremental packet, and compress it to a designated file;
    文件拷贝模块,用于根据所述增量包中的拷贝控制字段,将所述第一安装包中的待拷贝文件拷贝到所述指定文件,包括所述待拷贝文件和压缩后的所述第二目标文件的指定文件为第二安装包。The file copy module is configured to copy the file to be copied in the first installation package to the designated file according to the copy control field in the incremental package, including the file to be copied and the compressed first file The designated file of the second target file is the second installation package.
  17. 一种文件处理装置,其特征在于,所述文件处理装置包括:A file processing device, characterized in that, the file processing device includes:
    待处理文件获取模块,用于获取应用程序的第一安装包中待解压文件,第二安装包中待解压文件,以及所述第一安装包中与所述第二安装包中的待拷贝文件,其中,待拷贝文件是指所述第一安装包中和所述第二安装包中不存在差异的文件;The file to be processed acquiring module is used to acquire the files to be decompressed in the first installation package of the application, the files to be decompressed in the second installation package, and the files to be copied in the first installation package and the second installation package , Wherein the file to be copied refers to a file that has no difference between the first installation package and the second installation package;
    第一位置获取模块,用于获取所述第一安装包中待解压文件的起始位置和结束位置,所述待拷贝文件在所述第一安装包中的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置,以及所述待拷贝文件在所述第二安装包中的起始位置和结束位置;The first location obtaining module is configured to obtain the start position and the end position of the file to be decompressed in the first installation package, the start position and the end position of the file to be copied in the first installation package, the The start position and end position of the file to be decompressed in the second installation package, and the start position and end position of the file to be copied in the second installation package;
    文件解压模块,用于解压所述第一安装包中待解压文件和所述第二安装包中待解压文件,将所述第一安装包中待解压文件解压到第一目标文件,将所述第二安装包中待解压文件解压到第二目标文件;The file decompression module is configured to decompress the files to be decompressed in the first installation package and the files to be decompressed in the second installation package, decompress the files to be decompressed in the first installation package to a first target file, and Decompress the files to be decompressed in the second installation package to the second target file;
    第二位置获取模块,用于获取所述第一安装包中待解压文件解压后在所述第一目标文件中的起始位置和结束位置,以及所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置,其中,所述第二安装包中待解压文件解压后在所述第二目标文件中的起始位置和结束位置是指所述第二目标文件中待压缩文件的起始位置和结束位置,所述第二安装包中待解压文件的起始位置和结束位置是指所述第二目标文件中待压缩文件压缩后在所述第二安装包中的起始位置和结束位置;The second position obtaining module is used to obtain the start position and the end position of the file to be decompressed in the first installation package after decompression in the first target file, and after the file to be decompressed in the second installation package is decompressed The start position and the end position in the second target file, where the start position and the end position in the second target file after the file to be decompressed in the second installation package is decompressed refer to the first 2. The start position and the end position of the file to be compressed in the target file. The start position and the end position of the file to be decompressed in the second installation package refer to the second target file in the second target file after being compressed. 2. The start position and end position in the installation package;
    第一位置记录模块,用于将所述第一安装包中一个待解压文件的起始位置和结束位置以及该待解压文件解压后在所述第一目标文件中的起始位置和结束位置记录在一组解压控制字段中;The first position recording module is used to record the start position and end position of a file to be decompressed in the first installation package and the start position and end position of the file to be decompressed in the first target file after decompression In a group of decompression control fields;
    第二位置记录模块,用于将所述第二目标文件中一个待压缩文件的起始位置和结束位置以及该待压缩文件压缩后在所述第二安装包中的起始位置和结束位置记录在一组压缩控制字段中;The second position recording module is used to record the start position and end position of a file to be compressed in the second target file and the start position and end position of the file to be compressed in the second installation package after compression In a group of compression control fields;
    第三位置记录模块,用于将一个待拷贝文件在所述第一安装包中的起始位置和结束位置,以及在所述第二安装包中的起始位置和结束位置记录在一组拷贝控制字段中;The third position recording module is used to record the start position and end position of a file to be copied in the first installation package, and the start position and end position in the second installation package in a set of copies Control field
    差分处理模块,用于根据预设差分算法,获取所述第一目标文件中解压后的待解压文件与所述第二目标文件中解压后的待解压文件的增量文件;A difference processing module, configured to obtain, according to a preset difference algorithm, the decompressed file to be decompressed in the first target file and the incremental file of the decompressed file to be decompressed in the second target file;
    增量包处理模块,用于压缩所述增量文件,获得增量包,并在所述增量包中插入解压控制字段、压缩控制字段以及拷贝控制字段。The incremental package processing module is used to compress the incremental file to obtain the incremental package, and insert a decompression control field, a compression control field, and a copy control field into the incremental package.
  18. 一种移动终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至10任一项所述的文件处理方法的步骤。A mobile terminal, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program as claimed in claims 1 to 10. Steps of any of the file processing methods.
  19. 一种服务器,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求11至15任一项所述的文件处理方法的步骤。A server, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program as claimed in claims 11 to 15 Steps of any one of the file processing methods.
  20. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其 在在于,所述计算机程序被处理器执行时实现如权利要求1至10任一项所述的文件处理方法的步骤;或者所述计算机程序被处理器执行时实现如权利要求11至15任一项所述的文件处理方法的步骤。A computer-readable storage medium, the computer-readable storage medium stores a computer program, which, when the computer program is executed by a processor, implements the file processing method according to any one of claims 1 to 10 Step; or when the computer program is executed by a processor, the steps of the file processing method according to any one of claims 11 to 15 are realized.
PCT/CN2019/129151 2019-12-27 2019-12-27 File processing method, file processing device, mobile terminal and server WO2021128269A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980100487.1A CN114424162A (en) 2019-12-27 2019-12-27 File processing method, file processing device, mobile terminal and server
PCT/CN2019/129151 WO2021128269A1 (en) 2019-12-27 2019-12-27 File processing method, file processing device, mobile terminal and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/129151 WO2021128269A1 (en) 2019-12-27 2019-12-27 File processing method, file processing device, mobile terminal and server

Publications (1)

Publication Number Publication Date
WO2021128269A1 true WO2021128269A1 (en) 2021-07-01

Family

ID=76573555

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/129151 WO2021128269A1 (en) 2019-12-27 2019-12-27 File processing method, file processing device, mobile terminal and server

Country Status (2)

Country Link
CN (1) CN114424162A (en)
WO (1) WO2021128269A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170249140A1 (en) * 2014-05-30 2017-08-31 Guangzhou Ucweb Computer Technology Co., Ltd. Method and apparatus for incremental upgrade
CN107797818A (en) * 2017-03-28 2018-03-13 平安壹钱包电子商务有限公司 Application program updating method and device
CN108804130A (en) * 2017-05-03 2018-11-13 腾讯科技(深圳)有限公司 Program installation kit generation method and device
CN109582323A (en) * 2018-11-23 2019-04-05 网易(杭州)网络有限公司 Increment updating method, device, terminal and the server of application installation package
CN109697071A (en) * 2017-10-24 2019-04-30 腾讯科技(深圳)有限公司 Installation kit synthetic method, device, terminal and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170249140A1 (en) * 2014-05-30 2017-08-31 Guangzhou Ucweb Computer Technology Co., Ltd. Method and apparatus for incremental upgrade
CN107797818A (en) * 2017-03-28 2018-03-13 平安壹钱包电子商务有限公司 Application program updating method and device
CN108804130A (en) * 2017-05-03 2018-11-13 腾讯科技(深圳)有限公司 Program installation kit generation method and device
CN109697071A (en) * 2017-10-24 2019-04-30 腾讯科技(深圳)有限公司 Installation kit synthetic method, device, terminal and storage medium
CN109582323A (en) * 2018-11-23 2019-04-05 网易(杭州)网络有限公司 Increment updating method, device, terminal and the server of application installation package

Also Published As

Publication number Publication date
CN114424162A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
US9582513B2 (en) Accessing data in a compressed container through dynamic redirection
CN108874426B (en) Application program updating method and device and readable storage medium
CN104052818A (en) Version upgrade method and device for mobile terminal
US9311317B1 (en) Injecting custom data into files in zip format containing apps, without unzipping, resigning or re-zipping the files
CN111694589B (en) Upgrade package generation method, device, server and computer readable storage medium
CN108846129B (en) Storage data access method, device and storage medium
US20110321030A1 (en) Method and apparatus for updating a software image
CN112947981A (en) Application program resource updating method and device, terminal equipment and server
CN111176685A (en) Upgrading method and device
CN114880011A (en) OTA (over the air) upgrading method and device, electronic equipment and readable storage medium
CN114064073A (en) Software version upgrading method and device, computer equipment and storage medium
US11379215B1 (en) Application-update techniques
CN106775835B (en) Method, server and terminal for acquiring upgrade file
KR102088170B1 (en) Method of data structuring for difference between old and new data and device thereof
WO2021128269A1 (en) File processing method, file processing device, mobile terminal and server
CN110019040B (en) Folder processing method, mobile terminal and storage medium
WO2017036197A1 (en) Method and device for managing network element model
CN103220336B (en) The implementation method of vector clock and system in a kind of file synchronization
WO2021097758A1 (en) Incremental package generation method, incremental package generation apparatus, and server
WO2021114101A1 (en) Method and apparatus for incremental update of file, and terminal and computer-readable storage medium
WO2021097624A1 (en) File processing method, file processing apparatus, and terminal device
CN115421745A (en) Equipment remote upgrading method, device, terminal and storage medium
CN106326310B (en) Resource encryption updating method for mobile phone client software
CN111158773B (en) Method and system for KS (Key sheet) guided automatic batch installation
US11314603B2 (en) Recovery image downloads via data chunks

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: 19957551

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 291122)

122 Ep: pct application non-entry in european phase

Ref document number: 19957551

Country of ref document: EP

Kind code of ref document: A1