CN109408471B - Compressed packet decompression method and device based on matching tree and storage medium - Google Patents
Compressed packet decompression method and device based on matching tree and storage medium Download PDFInfo
- Publication number
- CN109408471B CN109408471B CN201811186773.8A CN201811186773A CN109408471B CN 109408471 B CN109408471 B CN 109408471B CN 201811186773 A CN201811186773 A CN 201811186773A CN 109408471 B CN109408471 B CN 109408471B
- Authority
- CN
- China
- Prior art keywords
- matching
- file
- tree
- configuration file
- decompressed
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
- 230000006837 decompression Effects 0.000 title claims abstract description 61
- 238000000034 method Methods 0.000 title claims abstract description 47
- 238000010276 construction Methods 0.000 claims abstract description 9
- 230000008569 process Effects 0.000 claims description 22
- 230000014509 gene expression Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 2
- 230000011218 segmentation Effects 0.000 claims 2
- 238000005265 energy consumption Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000001914 filtration Methods 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 230000006399 behavior Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention provides a compressed packet decompression method, a device and a storage medium based on a matching tree, wherein the method comprises the following steps: a matching tree construction step, namely constructing a matching tree based on the decompressed configuration file; and a decompression step, namely reading the file name of the file in the compressed packet, matching the file name by using the matching tree, decompressing the file if the matching is successful, and not decompressing the file if the matching is unsuccessful. Therefore, the required files are decompressed, unnecessary files are not decompressed, decompression speed is greatly improved, access times to the disk are reduced, IO performance of the disk is improved, energy consumption of the terminal device is reduced, occupation of storage space is reduced, operating speed of the terminal device is improved, and user experience is improved.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a compressed packet decompression method and device based on a matching tree and a storage medium.
Background
In the mobile internet era, the mobile phone becomes the most close-fitting and common tool equipment for people, and the data carried by the mobile phone is more and more abundant; the Android mobile phone has the highest market share and the largest annual global shipment, and affects the whole mobile internet market. With the large-area use of Android mobile phones, the security of Android is also more and more strict by Google corporation, and the security mechanism is upgraded year by year, so that the Android forensics also face more and more challenges. As early as Android 5.0, the difficulty of root mobile phones is increasing year by year, and the security mechanism is further improved until the current latest Android 8.0. The importance degree of the domestic mobile phone manufacturers on the mobile phone data safety is also improved year by year, so that the data of the mobile phones cannot be extracted easily after the mobile phones are directly root-started, and the data must be backed up; including the adb backup and backup tools provided by various vendors.
The backed-up file is a compressed file and comprises data of all applications, wherein the backed-up file comprises a large number of redundant files which are not required to be used in the acquisition process, a large amount of time is consumed in the process of decompressing the backed-up compressed file, and the files required specifically are filtered in the large number of files after decompression, so that the files required to be used are searched out, and the timeliness is greatly reduced; the redundant files are decompressed and occupy a large amount of storage space; when a mobile phone with large data volume is encountered, a compressed packet with large data volume is decompressed, which is a great test for the cruising ability of mobile equipment, and the running continuity of the equipment cannot be ensured, i.e. the energy consumption is higher; similar problems exist for all devices with insufficient storage capacity and devices with mobile requirements, so that the running speed of the terminal device is low, and the user experience is influenced. Therefore, the traditional way of decompressing the backup compressed packet cannot meet the high requirement of mobile data acquisition on timeliness.
In summary, the prior art has the following disadvantages:
1. all application backup files are decompressed, a large number of redundant files are contained, and limited storage space is wasted.
2. The original decompression mechanism decompresses all files of the whole compression packet, and has the problems of long decompression time and slow speed.
3. The backup files comprise a large number of files with different sizes, the disk is frequently written in the decompression process, and an IO bottleneck exists.
4. The battery loss of the mobile equipment is increased, the flow is decompressed and the files are written in for a long time, the electric quantity loss of the equipment is increased, the endurance of the mobile equipment is influenced, and the continuous operation capability of the mobile equipment is reduced.
Disclosure of Invention
The present invention provides the following technical solutions to overcome the above-mentioned drawbacks in the prior art.
A method for compressed packet decompression based on a matching tree, the method comprising:
a matching tree construction step, namely constructing a matching tree based on the decompressed configuration file;
and a decompression step, namely reading the file name of the file in the compressed packet, matching the file name by using the matching tree, decompressing the file if the matching is successful, and not decompressing the file if the matching is unsuccessful.
Still further, the decompression configuration file comprises a plurality of packets, each packet comprising a plurality of matching entries for matching files that need to be decompressed.
Furthermore, each matching entry is composed of a plurality of matching items, the "/" is used as a division symbol between the matching items, each matching item matches a file name or a directory name, the plurality of matching items of the matching entry are used for continuously matching a complete path of a file, the file name and the path of the file are determined to be unique, the matching items are the same as the file name and the path of the file, and for a variable file name, the matching items are regular expressions which begin with a ^ and end with a $ ".
Further, the operation of constructing the matching tree based on the decompressed configuration file is: and acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of the matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein the same-level directory is in the same layer of tree nodes, and the parent-child directory is corresponding to the parent-child node, so as to construct the matching tree.
Further, the way to obtain the decompressed configuration file is to customize the decompressed configuration file, obtain the decompressed configuration file from a local storage, or download the decompressed configuration file from a cloud server, or obtain the decompressed configuration file from other similar users.
Further, the decompressing step operates as: judging whether the compressed packet is read at present and ending, if so, exiting the decompression process, if not, reading the file name of the file, dividing the file name according to each level of directory structure, then matching with a matching tree, wherein the top layer of the matching tree corresponds to a root directory, the first layer corresponds to the first level of the file name, if the directory matches one of the nodes of the current level, continuing to match the child nodes of the corresponding node, otherwise, judging that the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the matching tree node ends at the beginning at the ^ by $ using a mode matching file/file folder, if the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the last child node is matched, the file/file folder needs to be stored, decompressing the current file, or decompressing all files in the folder, writing all files in the folder into a file system, and then continuing reading the compressed packet.
The invention also provides a compressed packet decompression device based on the matching tree, which comprises:
the matching tree construction unit is used for constructing a matching tree based on the decompressed configuration file;
and the decompression unit is used for reading the file name of the file in the compressed packet, matching the file name by using the matching tree, decompressing the file if the matching is successful, and not decompressing the file if the matching is unsuccessful.
Still further, the decompression configuration file comprises a plurality of packets, each packet comprising a plurality of matching entries for matching files that need to be decompressed.
Furthermore, each matching entry is composed of a plurality of matching items, the "/" is used as a division symbol between the matching items, each matching item matches a file name or a directory name, the plurality of matching items of the matching entry are used for continuously matching a complete path of a file, the file name and the path of the file are determined to be unique, the matching items are the same as the file name and the path of the file, and for a variable file name, the matching items are regular expressions which begin with a ^ and end with a $ ".
Further, the operation of constructing the matching tree based on the decompressed configuration file is: and acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of the matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein the same-level directory is in the same layer of tree nodes, and the parent-child directory is corresponding to the parent-child node, so as to construct the matching tree.
Further, the way to obtain the decompressed configuration file is to customize the decompressed configuration file, obtain the decompressed configuration file from a local storage, or download the decompressed configuration file from a cloud server, or obtain the decompressed configuration file from other similar users.
Further, the decompression unit performs the operations of: judging whether the compressed packet is read at present and ending, if so, exiting the decompression process, if not, reading the file name of the file, dividing the file name according to each level of directory structure, then matching with a matching tree, wherein the top layer of the matching tree corresponds to a root directory, the first layer corresponds to the first level of the file name, if the directory matches one of the nodes of the current level, continuing to match the child nodes of the corresponding node, otherwise, judging that the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the matching tree node ends at the beginning at the ^ by $ using a mode matching file/file folder, if the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the last child node is matched, the file/file folder needs to be stored, decompressing the current file, or decompressing all files in the folder, writing all files in the folder into a file system, and then continuing reading the compressed packet.
The invention also proposes a computer-readable storage medium having stored thereon computer program code which, when executed by a computer, performs any of the methods described above.
The invention has the technical effects that: according to the method, a matching tree is constructed by decompressing the configuration file, then the file name of the file in the compressed package is read, the matching tree is used for matching with the file name, if the matching is successful, the file is decompressed, and if the matching is unsuccessful, the file is not decompressed. Therefore, the required files are decompressed, unnecessary files are not decompressed, decompression speed is greatly improved, access times to the disk are reduced, IO performance of the disk is improved, energy consumption of the terminal device is reduced, occupation of storage space is reduced, operating speed of the terminal device is improved, and user experience is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings.
Fig. 1 is a flow diagram of a matching tree based method for decompression of compressed packets, according to an embodiment of the present invention.
FIG. 2 is a schematic diagram of a matching tree according to an embodiment of the present invention.
Fig. 3 is a structural diagram of an overall framework of backup file decompression of an Android mobile phone according to an embodiment of the present invention.
Fig. 4 is a block diagram of a matching tree based apparatus for decompressing a compressed packet according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows a matching tree based compressed packet decompression method of the present invention, which includes:
a matching tree construction step S101, constructing a matching tree based on the decompressed configuration file;
and a decompression step S102, reading the file name of the file in the compressed packet, matching the file name by using the matching tree, decompressing the file if the matching is successful, and not decompressing the file if the matching is unsuccessful.
The method is particularly suitable for mobile terminal equipment which can be a smart phone, a tablet computer, a notebook computer, a desktop computer or a PDA and the like, and of course, the mobile terminal equipment can also be other portable electronic equipment with a data processing function.
In one embodiment, the decompression configuration file comprises a plurality of packets, each packet comprising a plurality of matching entries for matching files that need decompression. For example, the packet may be a QQ, WeChat, email, address book, etc.; the matching entry is used for matching the file needing to be decompressed. By this organization, only a specific file can be decompressed, for example, only the QQ related file needs to be written into the file system when only the QQ related file is decompressed, while the files of other applications do not need to be decompressed and written into the file system.
In one embodiment, each matching entry is composed of a plurality of matching items, the "/" is used as a division symbol between the matching items, each matching item matches a file name or a directory name, the plurality of matching items of the matching entry are used for continuously matching a complete path of a file, the file name and the path of the file are determined to be unique, the matching items are the same as the file name and the path of the file, and for a variable file name, the matching items are regular expressions which begin with a ^ and end with a $ ".
One specific example is: mobile _ prefs/mobile _ qq. xml this file is decompressed if needed, since the file path is fixed and the file name is unique, the matching entry is then equal to com. If the file to be decompressed is similar to a non-fixed-name file of/com, tencent, mobile QQ/database/12345678. db (where 12345678 is a QQ number, this part is variable, and the QQ numbers of different users are different for different handsets), the variable part can implement pattern matching using the regular expression "< Lambda > [0-9] +. db", where the matching entry is com, tencent, mobile QQ/database/< Lambda > [0-9] +. db ].
The construction of the matching tree is the key point in the invention, which is the key step for realizing rapid decompression, and is one of the important points for realizing the invention, and the operation of constructing the matching tree based on the decompressed configuration file is as follows: and acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of the matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein the same-level directory is in the same layer of tree nodes, and the parent-child directory is corresponding to the parent-child node, so as to construct the matching tree. Fig. 2 shows a simple matching tree, and the actual matching tree also contains the relevant attributes of the corresponding node, such as whether the current node is a folder or a file, whether the current node describes a database, and so on.
In one embodiment, the manner of obtaining the decompressed configuration file is to customize the decompressed configuration file, obtain the decompressed configuration file from a local storage, or download the decompressed configuration file from a cloud server, or obtain the decompressed configuration file from other similar users. The similar users can be judged according to the behaviors of the terminals used by the users, and the files of the compressed packages can be analyzed to determine the similar users.
In one embodiment, the decompressing step operates as: judging whether the compressed packet is read at present and ending, if so, exiting the decompression process, if not, reading the file name of the file, dividing the file name according to each level of directory structure, then matching with a matching tree, wherein the top layer of the matching tree corresponds to a root directory, the first layer corresponds to the first level of the file name, if the directory matches one of the nodes of the current level, continuing to match the child nodes of the corresponding node, otherwise, judging that the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the matching tree node ends at the beginning at the ^ by $ using a mode matching file/file folder, if the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the last child node is matched, the file/file folder needs to be stored, decompressing the current file, or decompressing all files in the folder, writing all files in the folder into a file system, and then continuing reading the compressed packet.
The method can be used for quickly decompressing the backup file backup.tar of the Android mobile phone, the backup file backup.tar is taken as a compressed packet file, the QQ data decompression is taken as an example to explain the filtering and decompressing process, and the backup service component provides data backup service for the backup file component. The two backup service components belong to services of an Android operating system and comprise adb backups and backup tools customized by various manufacturers, the two backup service components are not modified, so that specific function implementation is not described, and an integral framework for decompressing backup files of the Android mobile phone is shown in fig. 3.
The specific flow example is as follows:
1) the backup file component communicates with the backup server component through the adb, and backups are carried out to obtain compressed packets backup of all data;
2) the decompression service component (a program module that can be constructed by the method shown in fig. 1) reads the decompression configuration file (the decompression configuration file is stored in the configuration file component), and resolves the decompression configuration file into a matching tree;
3) reading the backup.tar compressed file and reading the file list by the decompression service component to obtain a file name, wherein the file path is com.taobao.taobao/databases/data, the primary file name is com.taobao.taobao, the primary file name is not matched with com.tencent.mobileqq, and if the file is not a QQ file, the decompression service component does not decompress and skips the file, and continues to read the next file name;
4) continuing to read to obtain a file name com.tent.mobileqq/shared _ prefs/mobileQQ.xml, matching a primary directory with com.tent.mobileqq, matching a secondary directory with shared _ prefs, matching a tertiary file name with mobileQQ.xml, and matching file names, decompressing the file content and writing the file content into a disk;
5) continuing to read to obtain a file name com.tenent.mobileqq/app _ cache, matching the primary directory with the com.tenent.mobileqq, and mismatching the secondary directory app _ cache, wherein the secondary directory app _ cache is not a file to be stored, and continuing to read the next file without decompressing the file;
6) and continuously reading the file until the compressed packet file list is completely read, ending the decompression flow, and ending the filtering and decompression service.
With further reference to fig. 4, as an implementation of the method shown in fig. 1, the present application provides an embodiment of a matching tree based apparatus for decompressing a compressed packet, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 1, and the apparatus may be specifically included in various electronic devices.
Fig. 4 shows a matching tree based compressed packet decompression apparatus of the present invention, which includes:
a matching tree construction unit 401, configured to construct a matching tree based on the decompressed configuration file;
a decompressing unit 402, configured to read a file name of a file in a compressed packet, match the file name with the matching tree, decompress the file if the matching is successful, and not decompress the file if the matching is unsuccessful.
The device of the invention is particularly suitable for being integrated in mobile terminal equipment, wherein the mobile terminal equipment can be a smart phone, a tablet computer, a notebook computer, a desktop computer or a PDA, and the like, and the mobile terminal equipment can also be other portable electronic equipment with a data processing function.
In one embodiment, the decompression configuration file comprises a plurality of packets, each packet comprising a plurality of matching entries for matching files that need decompression. For example, the packet may be a QQ, WeChat, email, address book, etc.; the matching entry is used for matching the file needing to be decompressed. By this organization, only a specific file can be decompressed, for example, only the QQ related file needs to be written into the file system when only the QQ related file is decompressed, while the files of other applications do not need to be decompressed and written into the file system.
In one embodiment, each matching entry is composed of a plurality of matching items, the "/" is used as a division symbol between the matching items, each matching item matches a file name or a directory name, the plurality of matching items of the matching entry are used for continuously matching a complete path of a file, the file name and the path of the file are determined to be unique, the matching items are the same as the file name and the path of the file, and for a variable file name, the matching items are regular expressions which begin with a ^ and end with a $ ".
One specific example is: mobile _ prefs/mobile _ qq. xml this file is decompressed if needed, since the file path is fixed and the file name is unique, the matching entry is then equal to com. If the file to be decompressed is similar to a non-fixed-name file of/com, tencent, mobile QQ/database/12345678. db (where 12345678 is a QQ number, this part is variable, and the QQ numbers of different users are different for different handsets), the variable part can implement pattern matching using the regular expression "< Lambda > [0-9] +. db", where the matching entry is com, tencent, mobile QQ/database/< Lambda > [0-9] +. db ].
The construction of the matching tree is the key point in the invention, which is the key step for realizing rapid decompression, and is one of the important points for realizing the invention, and the operation of constructing the matching tree based on the decompressed configuration file is as follows: and acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of the matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein the same-level directory is in the same layer of tree nodes, and the parent-child directory is corresponding to the parent-child node, so as to construct the matching tree. Fig. 2 shows a simple matching tree, and the actual matching tree also contains the relevant attributes of the corresponding node, such as whether the current node is a folder or a file, whether the current node describes a database, and so on.
In one embodiment, the manner of obtaining the decompressed configuration file is to customize the decompressed configuration file, obtain the decompressed configuration file from a local storage, or download the decompressed configuration file from a cloud server, or obtain the decompressed configuration file from other similar users. The similar users can be judged according to the behaviors of the terminals used by the users, and the files of the compressed packages can be analyzed to determine the similar users.
In one embodiment, the decompression unit performs the operations of: judging whether the compressed packet is read at present and ending, if so, exiting the decompression process, if not, reading the file name of the file, dividing the file name according to each level of directory structure, then matching with a matching tree, wherein the top layer of the matching tree corresponds to a root directory, the first layer corresponds to the first level of the file name, if the directory matches one of the nodes of the current level, continuing to match the child nodes of the corresponding node, otherwise, judging that the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the matching tree node ends at the beginning at the ^ by $ using a mode matching file/file folder, if the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the last child node is matched, the file/file folder needs to be stored, decompressing the current file, or decompressing all files in the folder, writing all files in the folder into a file system, and then continuing reading the compressed packet.
The device can be integrated in electronic equipment and used for quickly decompressing the backup file backup. The two backup service components belong to services of an Android operating system and comprise adb backups and backup tools customized by various manufacturers, the two backup service components are not modified, so that specific function implementation is not described, and an integral framework for decompressing backup files of the Android mobile phone is shown in fig. 3.
The specific flow example is as follows:
1) the backup file component communicates with the backup server component through the adb, and backups are carried out to obtain compressed packets backup of all data;
2) the decompression service component (which may be the decompression device shown in fig. 4) reads the decompression configuration file (the decompression configuration file is stored in the configuration file component), and parses the decompression configuration file into a matching tree;
3) reading the backup.tar compressed file and reading the file list by the decompression service component to obtain a file name, wherein the file path is com.taobao.taobao/databases/data, the primary file name is com.taobao.taobao, the primary file name is not matched with com.tencent.mobileqq, and if the file is not a QQ file, the decompression service component does not decompress and skips the file, and continues to read the next file name;
4) continuing to read to obtain a file name com.tent.mobileqq/shared _ prefs/mobileQQ.xml, matching a primary directory with com.tent.mobileqq, matching a secondary directory with shared _ prefs, matching a tertiary file name with mobileQQ.xml, and matching file names, decompressing the file content and writing the file content into a disk;
5) continuing to read to obtain a file name com.tenent.mobileqq/app _ cache, matching the primary directory with the com.tenent.mobileqq, and mismatching the secondary directory app _ cache, wherein the secondary directory app _ cache is not a file to be stored, and continuing to read the next file without decompressing the file;
6) and continuously reading the file until the compressed packet file list is completely read, ending the decompression flow, and ending the filtering and decompression service.
The invention has the technical effects that: according to the method, a matching tree is constructed by decompressing the configuration file, then the file name of the file in the compressed package is read, the matching tree is used for matching with the file name, if the matching is successful, the file is decompressed, and if the matching is unsuccessful, the file is not decompressed. Therefore, the required files are decompressed, unnecessary files are not decompressed, decompression speed is greatly improved, access times to the disk are reduced, IO performance of the disk is improved, energy consumption of the terminal device is reduced, occupation of storage space is reduced, operating speed of the terminal device is improved, and user experience is improved.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
Finally, it should be noted that: although the present invention has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that: modifications and equivalents may be made thereto without departing from the spirit and scope of the invention and it is intended to cover in the claims the invention as defined in the appended claims.
Claims (13)
1. A compressed packet decompression method based on a matching tree is characterized by comprising the following steps:
a matching tree construction step, namely constructing a matching tree based on the decompressed configuration file, and specifically comprising the following steps: acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of a matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein directories at the same level are in the same layer of tree nodes, and parent-child directories are corresponding to parent-child nodes, so as to construct a matching tree;
and a decompression step, namely reading the file name of the file in the compressed packet, matching the file name by using the matching tree, decompressing the file if the matching is successful, and not decompressing the file if the matching is unsuccessful.
2. The method of claim 1, wherein the decompression profile comprises a plurality of packets, each packet comprising a plurality of matching entries for matching files that need to be decompressed.
3. The method of claim 2, wherein: each matching entry is composed of a plurality of matching items, the "/" is used as a segmentation symbol among the matching items, each matching item is matched with a file name or a directory name, the matching items of the matching entries are used for continuously matching a complete path of a file, the file names and the paths of the files are determined to be the same when only one is determined, and for variable file names, the matching items are regular expressions which begin at the ^ and end at the "$".
4. The method of claim 3, wherein the operation of building the matching tree based on the decompressed configuration file is: and acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of the matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein the same-level directory is in the same layer of tree nodes, and the parent-child directory is corresponding to the parent-child node, so as to construct the matching tree.
5. The method of claim 4, wherein the extracting the decompressed configuration file is performed by customizing the decompressed configuration file, extracting the decompressed configuration file from a local storage, downloading the decompressed configuration file from a cloud server, or extracting the decompressed configuration file from other similar users.
6. The method of claim 5, wherein the decompressing step operates by: judging whether the compressed packet is read at present and ending, if so, exiting the decompression process, if not, reading the file name of the file, dividing the file name according to each level of directory structure, then matching with a matching tree, wherein the top layer of the matching tree corresponds to a root directory, the first layer corresponds to the first level of the file name, if the directory matches one of the nodes of the current level, continuing to match the child nodes of the corresponding node, otherwise, judging that the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the matching tree node ends at the beginning at the ^ by $ using a mode matching file/file folder, if the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the last child node is matched, the file/file folder needs to be stored, decompressing the current file, or decompressing all files in the folder, writing all files in the folder into a file system, and then continuing reading the compressed packet.
7. A matching tree based apparatus for decompressing compressed packets, the apparatus comprising:
the matching tree construction unit is used for constructing a matching tree based on the decompressed configuration file, and specifically comprises the following steps: acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of a matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein directories at the same level are in the same layer of tree nodes, and parent-child directories are corresponding to parent-child nodes, so as to construct a matching tree;
and the decompression unit is used for reading the file name of the file in the compressed packet, matching the file name by using the matching tree, decompressing the file if the matching is successful, and not decompressing the file if the matching is unsuccessful.
8. The apparatus of claim 7, wherein the decompression profile comprises a plurality of packets, each packet comprising a plurality of matching entries for matching files that need to be decompressed.
9. The apparatus of claim 8, wherein: each matching entry is composed of a plurality of matching items, the "/" is used as a segmentation symbol among the matching items, each matching item is matched with a file name or a directory name, the matching items of the matching entries are used for continuously matching a complete path of a file, the file names and the paths of the files are determined to be the same when only one is determined, and for variable file names, the matching items are regular expressions which begin at the ^ and end at the "$".
10. The apparatus of claim 9, wherein the operation of building the matching tree based on the decompressed configuration file is: and acquiring a decompressed configuration file, taking a root node of the decompressed configuration file as a root of the matching tree, sequentially reading a group of the decompressed configuration file and each matching entry under the corresponding group, wherein the same-level directory is in the same layer of tree nodes, and the parent-child directory is corresponding to the parent-child node, so as to construct the matching tree.
11. The apparatus of claim 10, wherein the means for obtaining the decompressed configuration file is to customize the decompressed configuration file, obtain the decompressed configuration file from a local storage, download the decompressed configuration file from a cloud server, or obtain the decompressed configuration file from other similar users.
12. The apparatus of claim 11, wherein the decompression unit is configured to: judging whether the compressed packet is read at present and ending, if so, exiting the decompression process, if not, reading the file name of the file, dividing the file name according to each level of directory structure, then matching with a matching tree, wherein the top layer of the matching tree corresponds to a root directory, the first layer corresponds to the first level of the file name, if the directory matches one of the nodes of the current level, continuing to match the child nodes of the corresponding node, otherwise, judging that the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the matching tree node ends at the beginning at the ^ by $ using a mode matching file/file folder, if the matching is unsuccessful, ending the matching process, continuing to read the compressed packet, if the last child node is matched, the file/file folder needs to be stored, decompressing the current file, or decompressing all files in the folder, writing all files in the folder into a file system, and then continuing reading the compressed packet.
13. A computer-readable storage medium, characterized in that the storage medium has stored thereon computer program code which, when executed by a computer, performs the method of any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811186773.8A CN109408471B (en) | 2018-10-12 | 2018-10-12 | Compressed packet decompression method and device based on matching tree and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811186773.8A CN109408471B (en) | 2018-10-12 | 2018-10-12 | Compressed packet decompression method and device based on matching tree and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109408471A CN109408471A (en) | 2019-03-01 |
CN109408471B true CN109408471B (en) | 2021-05-04 |
Family
ID=65467051
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811186773.8A Active CN109408471B (en) | 2018-10-12 | 2018-10-12 | Compressed packet decompression method and device based on matching tree and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109408471B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112559463B (en) * | 2020-12-18 | 2023-08-25 | 杭州数梦工场科技有限公司 | Compressed file processing method and device |
CN113377711B (en) * | 2021-06-29 | 2024-04-30 | 云洗电子商务有限公司 | Data processing method, device, equipment and computer readable storage medium |
CN113419998B (en) * | 2021-08-25 | 2022-02-25 | 成都统信软件技术有限公司 | Folder processing method, computing device and readable storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104572966A (en) * | 2014-12-30 | 2015-04-29 | 北京奇虎科技有限公司 | Zip file unzipping method and device |
CN106775802A (en) * | 2016-11-14 | 2017-05-31 | 福建天泉教育科技有限公司 | Method and its system that mass small documents quickly update |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7797746B2 (en) * | 2006-12-12 | 2010-09-14 | Fortinet, Inc. | Detection of undesired computer files in archives |
-
2018
- 2018-10-12 CN CN201811186773.8A patent/CN109408471B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104572966A (en) * | 2014-12-30 | 2015-04-29 | 北京奇虎科技有限公司 | Zip file unzipping method and device |
CN106775802A (en) * | 2016-11-14 | 2017-05-31 | 福建天泉教育科技有限公司 | Method and its system that mass small documents quickly update |
Non-Patent Citations (1)
Title |
---|
基于.NET平台实现ZIP文件操作;李晓 等;《电脑知识与技术》;20120531;第8卷(第15期);3574-3576页 * |
Also Published As
Publication number | Publication date |
---|---|
CN109408471A (en) | 2019-03-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10713034B2 (en) | Updating web resources | |
TWI712956B (en) | Method and device for updating mobile terminal application program | |
EP3812889B1 (en) | Method for generating difference between new and old data in order to update software, and device therefor | |
CN103544220B (en) | Using recommendation method and apparatus | |
CN109408471B (en) | Compressed packet decompression method and device based on matching tree and storage medium | |
US20130311985A1 (en) | Updating Web Resources | |
CN106909597B (en) | Database migration method and device | |
CN105988996B (en) | Index file generation method and device | |
CN109829287A (en) | Api interface permission access method, equipment, storage medium and device | |
CN108804188A (en) | Changing an interface skin method and device | |
EP2553613A1 (en) | Method and apparatus for portable index on a removable storage medium | |
CN110377651A (en) | Processing method, device, equipment and the storage medium of batch data | |
CN107609047A (en) | Application recommendation method and device, mobile device and storage medium | |
CN112363871A (en) | Data file returning method, device and storage medium | |
CN110908958B (en) | File processing method, device, terminal and storage medium | |
CN103593233A (en) | Method and system for pushing software information | |
CN103678706A (en) | Picture recognition method, system, equipment and device based on screenshot information | |
CN103927301B (en) | A kind of method and device of utilization theme bag dynamic translation entry | |
CN113961841A (en) | Native application webpage loading method, system, storage medium and device | |
CN111552663A (en) | File consistency verification method, device, computer equipment and storage medium | |
CN115080114B (en) | Application program transplanting processing method, device and medium | |
CN115840598A (en) | Micro front-end architecture system, development method, device and medium based on application market | |
CN114675872B (en) | Data processing method, device, equipment and storage medium for application program | |
CN112035131A (en) | Method for processing internet software installation application | |
CN108509478B (en) | Splitting and calling method of rule engine file, electronic device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |