CN109597620B - Data processing method, device, equipment and storage medium - Google Patents

Data processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN109597620B
CN109597620B CN201810896882.2A CN201810896882A CN109597620B CN 109597620 B CN109597620 B CN 109597620B CN 201810896882 A CN201810896882 A CN 201810896882A CN 109597620 B CN109597620 B CN 109597620B
Authority
CN
China
Prior art keywords
source code
code file
data
data change
change information
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
Application number
CN201810896882.2A
Other languages
Chinese (zh)
Other versions
CN109597620A (en
Inventor
万里鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201810896882.2A priority Critical patent/CN109597620B/en
Publication of CN109597620A publication Critical patent/CN109597620A/en
Application granted granted Critical
Publication of CN109597620B publication Critical patent/CN109597620B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)
  • Telephone Function (AREA)

Abstract

The embodiment of the disclosure discloses a data processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring data change information associated with a source code file, wherein the source code file is a binary file; generating a data processing program matched with the data change information according to the data change type of the data change information; and calling the data processing program to process the source code file to form a new source code file matched with the data change information. The technical scheme of the embodiment of the disclosure improves the modification and packaging efficiency of the installation package on the premise of not modifying other resources, thereby enhancing the universality of modification and packaging of the installation package.

Description

Data processing method, device, equipment and storage medium
Technical Field
The embodiments of the present disclosure relate to the field of computer software application technologies, and in particular, to a data processing method, apparatus, device, and storage medium.
Background
For the Android system, installing an application through an APK (Android package) is a common application installation means. When an application is installed through an APK, an android manifest. Xml is a very important file in Android development, in which rights, components, and the like declared to a system are recorded. Xml is compiled into a special Binary format instead of plaintext, and the format is called axml (android Binary xml), so that the file volume can be reduced, and the IO (Input/Output) speed can be increased.
When the compiled APK needs to be modified and repackaged, the conventional idea of modifying the android Manifest is to perform reverse compilation and then compile the APK back after modification. Not only does this modification waste a lot of time, but it also relies on relevant resources when compiling the android manifest file, thereby causing resource reference problems.
Disclosure of Invention
The embodiment of the disclosure provides a data processing method, a data processing device, a data processing apparatus and a storage medium, which improve the modification and packaging efficiency of an installation package on the premise of not modifying other resources, thereby enhancing the universality of modification and packaging of the installation package.
In a first aspect, an embodiment of the present disclosure provides a data processing method, including:
acquiring data change information associated with a source code file, wherein the source code file is a binary file;
generating a data processing program matched with the data change information according to the data change type of the data change information;
and calling the data processing program to process the source code file to form a new source code file matched with the data change information.
Optionally, generating a data processing program matched with the data change information according to the data change type of the data change information, including:
acquiring a data processing basic code for changing a source code file, wherein the data processing basic code comprises at least one blank area matched with a data change type;
searching a blank area corresponding to a data change type of the data change information in the data processing basic code;
and correspondingly filling the blank area with the data change information to generate a data processing program matched with the data change information.
Optionally, the source code file includes: android manifest.
Wherein the android manifest. A header, a string region, a resource identification region, and an XML file region.
Optionally, the data change type of the data change information includes: new services injected in the source code file;
calling the data processing program to process the source code file to form a new source code file matched with the data change information, wherein the new source code file comprises the following steps:
calling the data processing program, writing the service name of the service into a character string area in the source code file, and recording an index value corresponding to the service;
searching an XML file area of the source code file for a root node associated with the service;
establishing a service node corresponding to the service, and updating the service node according to an index value corresponding to the service and attribute information of the service;
and adding the service node as a child node of the root node in the XML file area to form a new source code file matched with the data change information.
Optionally, the data change type of the data change information includes: modifying the target class in the source code file into a new class name;
calling the data processing program to process the source code file to form a new source code file matched with the data change information, wherein the new source code file comprises the following steps:
calling the data processing program, traversing each class node in an XML file area of the source code file to search a target node corresponding to the target class, and modifying the class name of the searched target node into the new class name;
acquiring an index value matched with the class name of the target class in the target node;
judging whether the character string area of the source code file comprises the index value: if so, modifying the class name associated with the search value in the character string area into the new class name; otherwise, writing the corresponding relation between the index value and the new class name in the character string area.
Optionally, before the data processing program is called to process the source code file to form a new source code file matched with the data change information, the method further includes:
according to a first reading strategy, reading binary data in the source code file in real time and writing the binary data into a memory;
if the encoding mode indicating field read to the source code file is detected, determining a second reading strategy according to the field value of the encoding mode indicating field;
continuously reading the content in the source code file in real time by using the second reading strategy until all the content in the source code file is written into the memory;
calling the data processing program to process the source code file to form a new source code file matched with the data change information, and specifically comprising the following steps:
and calling the data processing program to process the data content corresponding to the source code file in the memory, and rewriting the processed data content to the file to form a new source code file matched with the data change information.
Optionally, before acquiring the data change information associated with the source code file, the method further includes:
compiling an original source code to generate an original data packet corresponding to the original source code;
decompressing the original data packet to obtain a decompression result, wherein the decompression result comprises the source code file;
after the data processing program is called to process the source code file to form a new source code file matched with the data change information, the method further comprises the following steps:
and after replacing the source code file in the decompression result with the new source code file, repacking the decompression result to obtain a new data packet matched with the data change information.
In a second aspect, an embodiment of the present disclosure further provides a data processing apparatus, including:
the system comprises an information acquisition module, a data storage module and a data transmission module, wherein the information acquisition module is used for acquiring data change information associated with a source code file, and the source code file is a binary file;
the program generation module is used for generating a data processing program matched with the data change information according to the data change type of the data change information;
and the file forming module is used for calling the data processing program to process the source code file and form a new source code file matched with the data change information.
Optionally, the program generating module is specifically configured to obtain a data processing basic code for changing the source code file, where the data processing basic code includes at least one blank area that matches the data change type; searching a blank area corresponding to a data change type of the data change information in the data processing basic code; and correspondingly filling the blank area with the data change information to generate a data processing program matched with the data change information.
Optionally, the source code file includes: android manifest. Wherein the android manifest. A header, a string region, a resource identification region, and an XML file region.
Optionally, the data change type of the data change information includes: new services injected in the source code file; a file forming module, specifically configured to invoke the data processing program, write the service name of the service into a character string area in the source code file, and record an index value corresponding to the service; searching an XML file area of the source code file for a root node associated with the service; establishing a service node corresponding to the service, and updating the service node according to an index value corresponding to the service and attribute information of the service; and adding the service node as a child node of the root node in the XML file area to form a new source code file matched with the data change information.
Optionally, the data change type of the data change information includes: modifying the target class in the source code file into a new class name; the file forming module is specifically used for calling the data processing program, traversing each class node in an XML file area of the source code file to search a target node corresponding to the target class, and modifying the class name of the searched target node into the new class name; acquiring an index value matched with the class name of the target class in the target node; judging whether the character string area of the source code file comprises the index value: if so, modifying the class name associated with the search value in the character string area into the new class name; otherwise, writing the corresponding relation between the index value and the new class name in the character string area.
Optionally, the apparatus further comprises: the data writing module is used for reading binary data in the source code file in real time according to a first reading strategy and writing the binary data into the memory; the strategy determining module is used for determining a second reading strategy according to the field value of the encoding mode indication field if the encoding mode indication field read to the source code file is detected; the content writing module is used for continuously reading the content in the source code file in real time by using the second reading strategy until all the content in the source code file is written into the memory; and the file forming module is specifically used for calling the data processing program to process the data content corresponding to the source code file in the memory and writing back the processed data content to the file again so as to form a new source code file matched with the data change information.
Optionally, the apparatus further comprises: the data packet generating module is used for compiling an original source code and generating an original data packet corresponding to the original source code; the decompression module is used for decompressing the original data packet to obtain a decompression result, wherein the decompression result comprises the source code file; and the data packing module is used for repacking the decompression result after replacing the source code file in the decompression result with the new source code file to obtain a new data packet matched with the data change information.
In a third aspect, an embodiment of the present disclosure further provides a computer device, where the computer device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method provided by any embodiment of the disclosure.
In a fourth aspect, the embodiments of the present disclosure also provide a computer storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the data processing method provided in any of the embodiments of the present disclosure.
The data processing method comprises the steps of acquiring data change information associated with a source code file, and generating a data processing program matched with the data change information according to the data change type of the data change information; therefore, a data processing program is called to process the source code file to form a new source code file matched with the data change information, the problems of low resource reference and modification packaging efficiency and the like in the modification packaging process of the existing installation package are solved, the modification packaging efficiency of the installation package is improved on the premise of not modifying other resources, and the universality of modification packaging of the installation package is enhanced.
Drawings
Fig. 1 is a flowchart of a data processing method according to an embodiment of the disclosure;
fig. 2 is a flowchart of a data processing method provided in the second embodiment of the present disclosure;
fig. 3 is a flowchart of a data processing method provided in the third embodiment of the present disclosure;
fig. 4 is a schematic diagram of a data processing apparatus according to a fourth embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the disclosure and are not limiting of the disclosure.
It is also noted that, for the sake of convenience in description, only some but not all of the matters related to the present disclosure are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a flowchart of a data processing method provided in an embodiment of the present disclosure, where the embodiment is applicable to a case of modifying a packaged installation package, and the method may be executed by a data processing apparatus, and the apparatus may be implemented by software and/or hardware, and may be generally integrated in a computer device. Accordingly, as shown in fig. 1, the method comprises the following operations:
s110, obtaining data change information associated with a source code file, wherein the source code file is a binary file.
The source code file refers to a set of source codes, and the source codes are a group of characters which have specific meanings and can realize specific functions. In the disclosed embodiments, the source code file may be a file formed of binary code. The data change information may be change information or a requirement of related data in the source code file, for example, the data change information may be to modify specified data in the source code file, or the data change information may also be to add or delete a service in the source code file, and any information that may cause a change to data in the source code file may be used as the data change information, which is not limited in the embodiment of the present disclosure.
In the embodiment of the present disclosure, before modifying data in a source file, data change information associated with the source code file needs to be acquired first, so as to modify the source code file according to the data change information.
In an optional embodiment of the present disclosure, the source code file may include: android manifest. Wherein the android manifest. A header, a string region, a resource identifier region, and an XML (Extensible Markup Language) file region.
Xml is a necessary file in each android program, is located in a root directory of the whole APK, and describes exposed component information in the APK.
In the embodiment of the present disclosure, optionally, the source code file may be an Android manifest. XML configuration files can be roughly divided into four areas, i.e., a header, a string area, a resource identification area, and an XML file area, according to functional division, and the concept of Chunk is introduced. The header mainly contains two fields, magic number (0x00080003) and file size, which are four bytes each. The character string area mainly stores a character string pool, and character strings in the character string pool are all character string information in the android manifest. The String area is usually identified by 4 bytes, such as Chunk Type, Chunk Size, or String Count, and then the offset of each String can be identified separately, so as to obtain the content of the String pool. The resource identification area mainly stores a plurality of resource id values, the structure is simple, and the reading mode is relatively easy. XML file area is the core part of the whole android manifest. The method comprises the steps of naming space, Tag related information, overall XML tree hierarchical structure information and the like. The XML file region may be divided into a Start Namespace Chunk, an End Namespace Chunk, a Start Tag Chunk, an End Tag Chunk, and a Text Chunk. The Namespace contains a plurality of tags, each Tag contains a name and an indefinite number of attributes, and simultaneously can contain a plurality of lower-layer tags, thereby forming a tree structure. And the root node Tag of the whole android manifest. Xml configuration files are in a specific format of the prior art, and embodiments of the present disclosure are not described in detail.
And S120, generating a data processing program matched with the data change information according to the data change type of the data change information.
The data change type refers to a modification type of the source file, such as modifying data, adding a service or deleting a service, and the like. The data processing program is a program for modifying data in the source code file and is independent of the source code file. It should be noted that the data processing program may be designed according to actual needs, and the specific content of the data processing program is not limited in the embodiments of the present disclosure.
In the embodiment of the disclosure, when the data in the source code file is modified, the data in the source code file does not need to be directly searched and modified, but the modification of the source code file is automatically completed through a data processing program. The data handler may be generated based on the data change type of the data change information. It should be noted that one data processing program may complete data modification of multiple types of source code files for different data change types, or may complete data modification of a source code file for only one type of data change type. That is, one data change type may correspond to one data processing program, or one data processing program may be generated by a plurality of data change types.
And S130, calling the data processing program to process the source code file to form a new source code file matched with the data change information.
In the embodiment of the present disclosure, after the corresponding data processing program is generated according to the data change type and the data change information, the generated data processing program may be called to process the data in the source code file. It should be noted that one source code file may use one data processing program, or may use multiple data processing programs, which is not limited in this disclosure. And after the data in the source code file is processed by adopting the data processing program, the original source code file is combined with the modified data information to be transformed into a new source code file matched with the data change information.
The data processing method comprises the steps of acquiring data change information associated with a source code file, and generating a data processing program matched with the data change information according to the data change type of the data change information; therefore, a data processing program is called to process the source code file to form a new source code file matched with the data change information, the problems of low resource reference and modification packaging efficiency and the like in the modification packaging process of the existing installation package are solved, the modification packaging efficiency of the installation package is improved on the premise of not modifying other resources, and the universality of modification packaging of the installation package is enhanced.
Example two
Fig. 2 is a flowchart of a data processing method according to a second embodiment of the present disclosure, which is embodied based on various optional solutions in the foregoing embodiments, and in this embodiment, a specific implementation manner of generating a data processing program matching with the data change information according to the data change type of the data change information is given, and a specific implementation manner of calling the data processing program to process the source code file to form a new source code file matching with the data change information is given for a data change type of a new service injected in the source code file. Correspondingly, as shown in fig. 2, the method of the present embodiment may include:
s210, obtaining data change information associated with a source code file, wherein the source code file is a binary file.
In an optional embodiment of the present disclosure, before obtaining the data change information associated with the source code file, the method may further include: compiling an original source code to generate an original data packet corresponding to the original source code; and decompressing the original data packet to obtain a decompression result, wherein the decompression result comprises the source code file.
The original source code may be a code program written in assembly language or high-level language for generating an installation package. The original data package is an installation package generated by compiling and running after the original source code is compiled.
In the embodiment of the present disclosure, when generating an original installation package, an original source code program corresponding to the original installation package may be compiled, so as to obtain the original installation package in a compressed file form. The original installation package can install relevant applications in a decompression mode, and after the original installation package is decompressed, the obtained root directory can include a source code file, namely an android manifest.
And S220, generating a data processing program matched with the data change information according to the data change type of the data change information.
Optionally, in an embodiment, S220 may include the following operations:
s221, acquiring a data processing basic code for changing the source code file, wherein the data processing basic code comprises at least one blank area matched with the data change type.
The data processing basic code can be a template file for performing data modification on the source code file.
In the embodiment of the present disclosure, the data processing basic code has a basic function of modifying data in a source code file (i.e., android manifest. xml configuration file), and in order to make the data processing program have better versatility, the basic function for modifying the source code file may be edited in the data processing program, and a corresponding blank area is set in the data processing basic code for filling in corresponding data according to a modification requirement.
S222, searching for a blank area corresponding to the data change type of the data change information in the data processing basic code.
And S223, correspondingly filling the data change information in the blank area to generate a data processing program matched with the data change information.
Correspondingly, when the source code file needs to be modified, only the blank area part in the data processing basic code needs to be filled with the data change information needing to be changed. Then, the data processing basic code is operated to generate a data processing program meeting the change requirement.
For example, it is assumed that the data processing basic code includes a basic code segment of "android: name" ". The base code fragment means that the name of the corresponding application in the android manifest xml configuration file can be modified. If the application name in the source code file needs to be modified, the name needing to be modified can be directly added into the basic code segment. If the data change information "a certain treasure" is added to the blank area of the basic code segment, the name of the application can be modified into "a certain treasure" by the corresponding "android: name" and "a certain treasure" in the generated data processing program.
And S230, calling the data processing program to process the source code file to form a new source code file matched with the data change information.
The data change type of the data change information may specifically include: new services injected in the source code file.
Optionally, in an embodiment, S230 may include the following operations:
s231, calling the data processing program, writing the service name of the service into the character string area in the source code file, and recording the index value corresponding to the service.
Specifically, if the data change type of the data change information is to inject a new service into the android manifest.
S232, searching a root node associated with the service in the XML file area of the source code file.
Correspondingly, after the data processing is completed on the character string area of the android manifest.
S233, establishing a service node corresponding to the service, and updating the service node according to the index value corresponding to the service and the attribute information of the service.
Meanwhile, the newly added service needs to configure corresponding nodes in the android manifest.
S234, adding the service node as a child node of the root node in the XML file area to form a new source code file matched with the data change information.
And finally, establishing a connection between the newly added service node and the root node of the android manifest. Specifically, the newly added service node can be added as a child node of the root node in an XML file area of the android manifest.
The embodiment of the disclosure obtains the data change information associated with the source code file, and according to the data change type of the data change information: injecting new services into the source code file to generate a data processing program matched with the data change information of the new services; therefore, a data processing program is called to process the source code file to form a new source code file matched with the data change information, the problems of low resource reference and modification packaging efficiency and the like in the modification packaging process of the existing installation package are solved, the modification packaging efficiency of the installation package is improved on the premise of not modifying other resources, and the universality of modification packaging of the installation package is enhanced.
EXAMPLE III
Fig. 3 is a flowchart of a data processing method provided in a third embodiment of the present disclosure, which is embodied based on various optional solutions in the foregoing embodiments, and in this embodiment, a specific implementation manner for calling the data processing program to process the source code file to form a new source code file matched with the data change information is given for a data change type in which a target class in the source code file is modified to a new class name. Accordingly, as shown in fig. 3, the method of the present embodiment may include:
s310, acquiring data change information associated with a source code file, wherein the source code file is a binary file.
And S320, generating a data processing program matched with the data change information according to the data change type of the data change information.
Optionally, in an embodiment, S320 may include the following operations:
s321, acquiring a data processing basic code for changing the source code file, wherein the data processing basic code comprises at least one blank area matched with the data change type.
S322, searching for a blank area corresponding to the data change type of the data change information in the data processing basic code.
And S323, correspondingly filling the data change information in the blank area to generate a data processing program matched with the data change information.
And S330, calling the data processing program to process the source code file to form a new source code file matched with the data change information.
The data change type of the data change information may specifically include: and modifying the target class in the source code file into a new class name.
Optionally, in an embodiment, S330 may include the following operations:
s331, calling the data processing program, traversing each class node in an XML file area of the source code file to search a target node corresponding to the target class, and modifying the class name of the searched target node into the new class name.
The target class may be a class existing in the XML file area and requiring related data modification.
Specifically, if the data change type of the data change information is to modify a target class in the android manifest. When the XML file area is modified, the data processing program can be called to traverse all the class nodes in the XML file area of the android manifest.
S332, acquiring the index value matched with the class name of the target class in the target node.
Similarly, when modifying the class name, an index value matching the class name of the target class needs to be obtained in the target node.
S333, judging whether the character string area of the source code file comprises the index value: if yes, go to S334; otherwise, S335 is performed.
And S334, modifying the class name associated with the search value in the character string area into the new class name.
And S335, writing the corresponding relation between the index value and the new class name in the character string area.
And finally, judging whether the character string area of the android manifest. Modifying a class name associated with a search value in a character string area into a new class name if the character string area of the android manifest. Otherwise, writing the corresponding relation between the index value matched with the class name of the target class and the new class name in the character string area, thereby establishing the direct relation between the index value and the class name.
In an optional embodiment of the present disclosure, before invoking the data handler to process the source code file to form a new source code file matching the data change information, the method may further include: according to a first reading strategy, reading binary data in the source code file in real time and writing the binary data into a memory; if the encoding mode indicating field read to the source code file is detected, determining a second reading strategy according to the field value of the encoding mode indicating field; and continuously reading the content in the source code file in real time by using the second reading strategy until all the content in the source code file is written into the memory. Correspondingly, invoking the data processing program to process the source code file to form a new source code file matched with the data change information, which may specifically include: and calling the data processing program to process the data content corresponding to the source code file in the memory, and rewriting the processed data content to the file to form a new source code file matched with the data change information.
The first read strategy may be any type of read strategy, such as reading 2 bytes or 4 bytes at a time. The second reading strategy may be a targeted reading strategy set for the encoding mode in the source code file. For example, if the encoding manner indication field in the source Code file indicates that the source Code file adopts an ASCII (American Standard Code for Information exchange) manner, since ASCII Code is 7-bit encoding, the second read policy may be set to 7 bytes per read.
In the embodiment of the present disclosure, the source code file may be first written into the memory, and the data processing program is called to process the data content corresponding to the source code file in the memory. After the processing is finished, the processed data content stored in the memory is rewritten back to the source code file, so that a new source code file matched with the data change information is formed. That is, when modifying the data in the source code file, the main data in the source code file may be copied to the memory for modification instead of being directly modified on the source code file. It should be noted that, because different source code files may adopt different encoding modes, if the same data reading mode is adopted for all the source code files, when the data reading mode is not matched with the encoding mode, the problem of content reading error may be caused. Therefore, for source code files with different encoding modes, a corresponding data reading strategy needs to be adopted to avoid the problem of data reading errors.
Specifically, first, a first reading strategy may be adopted to read binary data in the source code file in real time and write the binary data into the memory. Because the indication field corresponding to the encoding mode exists in the source code file, and the content before the indication field corresponding to the encoding mode is some irrelevant content, even if the data reading is wrong, the source code file is not greatly influenced. Accordingly, the data may be read in real time using a first read strategy to detect the encoding mode indication field. When the encoding mode indication field is detected, the matched second reading strategy can be determined according to the field value in the encoding mode indication field. And continuously reading the residual content in the source code file in real time by using a second reading strategy, and writing the read content into the memory.
In an optional embodiment of the present disclosure, after invoking the data handler to process the source code file, and forming a new source code file matching the data change information, the method may further include: and after replacing the source code file in the decompression result with the new source code file, repacking the decompression result to obtain a new data packet matched with the data change information.
Correspondingly, the data processing program can be called to process the data content of the source code file written in the memory, and the processed data content is written back to the file again to form a new source code file matched with the data change information.
The embodiment of the disclosure obtains the data change information associated with the source code file, and according to the data change type of the data change information: modifying the target class in the source code file into a new class name, and generating a data processing program matched with the data change information of the target class; therefore, a data processing program is called to process the source code file to form a new source code file matched with the data change information, the problems of low resource reference and modification packaging efficiency and the like in the modification packaging process of the existing installation package are solved, the modification packaging efficiency of the installation package is improved on the premise of not modifying other resources, and the universality of modification packaging of the installation package is enhanced.
It should be noted that any permutation and combination between the technical features in the above embodiments also belong to the scope of the present disclosure.
Example four
Fig. 4 is a schematic diagram of a data processing apparatus according to a fourth embodiment of the present disclosure, and as shown in fig. 4, the apparatus includes: an information acquisition module 410, a program generation module 420, and a file formation module 430, wherein:
an information obtaining module 410, configured to obtain data change information associated with a source code file, where the source code file is a binary file;
a program generating module 420, configured to generate a data processing program matching the data change information according to the data change type of the data change information;
and a file forming module 430, configured to invoke the data processing program to process the source code file, so as to form a new source code file matched with the data change information.
The data processing method comprises the steps of acquiring data change information associated with a source code file, and generating a data processing program matched with the data change information according to the data change type of the data change information; therefore, a data processing program is called to process the source code file to form a new source code file matched with the data change information, the problems of low resource reference and modification packaging efficiency and the like in the modification packaging process of the existing installation package are solved, the modification packaging efficiency of the installation package is improved on the premise of not modifying other resources, and the universality of modification packaging of the installation package is enhanced.
Optionally, the program generating module 420 is specifically configured to obtain a data processing basic code for changing the source code file, where the data processing basic code includes at least one blank area matched with the data change type; searching a blank area corresponding to a data change type of the data change information in the data processing basic code; and correspondingly filling the blank area with the data change information to generate a data processing program matched with the data change information.
Optionally, the source code file includes: android manifest. Wherein the android manifest. A header, a string region, a resource identification region, and an XML file region.
Optionally, the data change type of the data change information includes: new services injected in the source code file; a file forming module 430, configured to invoke the data processing program, write the service name of the service into a character string area in the source code file, and record an index value corresponding to the service; searching an XML file area of the source code file for a root node associated with the service; establishing a service node corresponding to the service, and updating the service node according to an index value corresponding to the service and attribute information of the service; and adding the service node as a child node of the root node in the XML file area to form a new source code file matched with the data change information.
Optionally, the data change type of the data change information includes: modifying the target class in the source code file into a new class name; a file forming module 430, configured to invoke the data processing program, traverse each class node in an XML file area of the source code file to search for a target node corresponding to the target class, and modify the class name of the searched target node into the new class name; acquiring an index value matched with the class name of the target class in the target node; judging whether the character string area of the source code file comprises the index value: if so, modifying the class name associated with the search value in the character string area into the new class name; otherwise, writing the corresponding relation between the index value and the new class name in the character string area.
Optionally, the apparatus further comprises: the data writing module is used for reading binary data in the source code file in real time according to a first reading strategy and writing the binary data into the memory; the strategy determining module is used for determining a second reading strategy according to the field value of the encoding mode indication field if the encoding mode indication field read to the source code file is detected; the content writing module is used for continuously reading the content in the source code file in real time by using the second reading strategy until all the content in the source code file is written into the memory; the file forming module 430 is specifically configured to invoke the data processing program to process the data content corresponding to the source code file in the memory, and write back the processed data content to the file again, so as to form a new source code file matched with the data change information.
Optionally, the apparatus further comprises: the data packet generating module is used for compiling an original source code and generating an original data packet corresponding to the original source code; the decompression module is used for decompressing the original data packet to obtain a decompression result, wherein the decompression result comprises the source code file; and the data packing module is used for repacking the decompression result after replacing the source code file in the decompression result with the new source code file to obtain a new data packet matched with the data change information.
The data processing device can execute the data processing method provided by any embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to a data processing method provided in any embodiment of the present disclosure.
EXAMPLE five
Fig. 5 is a diagram illustrating a hardware structure of a computer apparatus according to an embodiment of the present disclosure. The computer device may be implemented in various forms, and the computer device in the present disclosure may include, but is not limited to, mobile computer devices such as a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation apparatus, a vehicle terminal device, a vehicle display terminal, a vehicle electronic rear view mirror, and the like, and stationary computer devices such as a digital TV, a desktop computer, and the like.
As shown in fig. 5, the computer device 0 may include a wireless communication unit 51, an a/V (audio/video) input unit 52, a user input unit 53, a sensing unit 54, an output unit 55, a memory 56, an interface unit 57, a processor 58, a power supply unit 59, and the like. Fig. 5 shows computer device 0 having various components, but it is understood that not all of the illustrated components are required to be implemented. More or fewer components may alternatively be implemented.
Among other things, the wireless communication unit 51 allows radio communication between the computer device 0 and a wireless communication system or network. The a/V input unit 52 is for receiving an audio or video signal. The user input unit 53 may generate key input data to control various operations of the computer device 0 according to commands input by the user. The sensing unit 54 detects the current state of the computer device 0, the position of the computer device 0, the presence or absence of a touch input by a user to the computer device 0, the orientation of the computer device 0, the acceleration or deceleration movement and direction of the computer device 0, and the like, and generates a command or signal for controlling the operation of the computer device 0. The interface unit 57 serves as an interface through which at least one external device is connected to the computer apparatus 0. The output unit 55 is configured to provide output signals in a visual, audio, and/or tactile manner. The memory 56 may store software programs or the like for processing and controlling operations performed by the processor 58, or may temporarily store data that has been or will be output. The memory 56 may include at least one type of storage medium. Also, the computer apparatus 0 may cooperate with a network storage device that performs a storage function of the memory 56 through network connection. Processor 58 generally controls the overall operation of computer device 0. In addition, the processor 58 may include a multimedia module for rendering or playing back multimedia data. The processor 58 may perform a pattern recognition process to recognize a handwriting input or a picture drawing input performed on the touch screen as a character or an image. The power supply unit 59 receives external power or internal power and supplies appropriate power required to operate the respective elements and components under the control of the processor 58.
The processor 58 executes programs stored in the memory 56 to execute various functional applications and data processing, for example, to implement a data processing method provided by the embodiment of the present disclosure, including:
acquiring data change information associated with a source code file, wherein the source code file is a binary file;
generating a data processing program matched with the data change information according to the data change type of the data change information;
and calling the data processing program to process the source code file to form a new source code file matched with the data change information.
EXAMPLE six
A sixth embodiment of the present disclosure further provides a computer storage medium storing a computer program, which when executed by a computer processor is configured to execute the data processing method according to any one of the above embodiments of the present disclosure: acquiring data change information associated with a source code file, wherein the source code file is a binary file; generating a data processing program matched with the data change information according to the data change type of the data change information; and calling the data processing program to process the source code file to form a new source code file matched with the data change information.
The computer storage media of the disclosed embodiments may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM) or flash Memory), an optical fiber, a portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, Radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present disclosure and the technical principles employed. Those skilled in the art will appreciate that the present disclosure is not limited to the particular embodiments described herein, and that various obvious changes, adaptations, and substitutions are possible, without departing from the scope of the present disclosure. Therefore, although the present disclosure has been described in greater detail with reference to the above embodiments, the present disclosure is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present disclosure, the scope of which is determined by the scope of the appended claims.

Claims (10)

1. A data processing method, comprising:
acquiring data change information associated with a source code file in an installation package, wherein the source code file is a binary file;
generating a data processing program matched with the data change information according to the data change type of the data change information, wherein the data change type is a modification type of a source code file and comprises at least one of a class name of a modification target class, an adding service or a deleting service, the data processing program matched with the data change information is a program which is generated based on data processing basic code and is independent of the source code file, the data processing basic code is a template file used for carrying out data modification on the source code file, the data processing basic code comprises at least one blank area matched with the data change type, and the blank area is used for filling the data change information;
and calling the data processing program to process the source code file to form a new source code file which is matched with the data change information and corresponds to the installation package.
2. The method of claim 1, wherein generating a data handler that matches the data change information based on the data change type of the data change information comprises:
acquiring a data processing basic code for changing a source code file;
searching a blank area corresponding to a data change type of the data change information in the data processing basic code;
and correspondingly filling the blank area with the data change information to generate a data processing program matched with the data change information.
3. The method of claim 1, wherein the source code file comprises: android manifest.
Wherein the android manifest. A header, a string region, a resource identification region, and an XML file region.
4. The method of claim 3, wherein the data change type of the data change information comprises: new services injected in the source code file;
calling the data processing program to process the source code file to form a new source code file matched with the data change information, wherein the new source code file comprises the following steps:
calling the data processing program, writing the service name of the service into a character string area in the source code file, and recording an index value corresponding to the service;
searching an XML file area of the source code file for a root node associated with the service;
establishing a service node corresponding to the service, and updating the service node according to an index value corresponding to the service and attribute information of the service;
and adding the service node as a child node of the root node in the XML file area to form a new source code file matched with the data change information.
5. The method of claim 3, wherein the data change type of the data change information comprises: modifying the target class in the source code file into a new class name;
calling the data processing program to process the source code file to form a new source code file matched with the data change information, wherein the new source code file comprises the following steps:
calling the data processing program, traversing each class node in an XML file area of the source code file to search a target node corresponding to the target class, and modifying the class name of the searched target node into the new class name;
acquiring an index value matched with the class name of the target class in the target node;
judging whether the character string area of the source code file comprises an index value: if so, modifying the class name associated with the search value in the character string area into the new class name; otherwise, writing the corresponding relation between the index value and the new class name in the character string area.
6. The method according to any one of claims 1-5, before invoking the data handler to process the source code file to form a new source code file matching the data change information, further comprising:
according to a first reading strategy, reading binary data in the source code file in real time and writing the binary data into a memory;
if the encoding mode indicating field read to the source code file is detected, determining a second reading strategy according to the field value of the encoding mode indicating field;
continuously reading the content in the source code file in real time by using the second reading strategy until all the content in the source code file is written into the memory;
calling the data processing program to process the source code file to form a new source code file matched with the data change information, and specifically comprising the following steps:
and calling the data processing program to process the data content corresponding to the source code file in the memory, and rewriting the processed data content to the file to form a new source code file matched with the data change information.
7. The method of any of claims 1-5, further comprising, prior to obtaining the data change information associated with the source code file:
compiling an original source code to generate an original data packet corresponding to the original source code;
decompressing the original data packet to obtain a decompression result, wherein the decompression result comprises the source code file;
after the data processing program is called to process the source code file to form a new source code file matched with the data change information, the method further comprises the following steps:
and after replacing the source code file in the decompression result with the new source code file, repacking the decompression result to obtain a new data packet matched with the data change information.
8. A data processing apparatus, comprising:
the information acquisition module is used for acquiring data change information associated with a source code file in the installation package, wherein the source code file is a binary file;
a program generating module, configured to generate a data processing program matched with data change information according to a data change type of the data change information, where the data change type is a modification type of a source code file, and includes at least one of a class name of a modification target class, an addition service, or a deletion service, the data processing program matched with the data change information is a program independent of the source code file and generated based on a data processing basic code, the data processing basic code is a template file for performing data modification on the source code file, the data processing basic code includes at least one blank area matched with the data change type, and the blank area is used for filling the data change information;
and the file forming module is used for calling the data processing program to process the source code file and form a new source code file which is matched with the data change information and corresponds to the installation package.
9. A computer device, the device comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a data processing method as claimed in any one of claims 1-7.
10. A computer storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the data processing method of any one of claims 1 to 7.
CN201810896882.2A 2018-08-08 2018-08-08 Data processing method, device, equipment and storage medium Active CN109597620B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810896882.2A CN109597620B (en) 2018-08-08 2018-08-08 Data processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810896882.2A CN109597620B (en) 2018-08-08 2018-08-08 Data processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109597620A CN109597620A (en) 2019-04-09
CN109597620B true CN109597620B (en) 2022-04-01

Family

ID=65956788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810896882.2A Active CN109597620B (en) 2018-08-08 2018-08-08 Data processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109597620B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457021B (en) * 2019-07-12 2023-05-16 招商局金融科技有限公司 Index data processing method, device and computer readable storage medium
CN113515269B (en) * 2021-09-13 2021-12-31 腾讯科技(深圳)有限公司 Application package processing method and device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462959A (en) * 2014-12-04 2015-03-25 北京奇虎科技有限公司 Reinforcement protection method, sever and system for android app
CN105354485A (en) * 2015-10-13 2016-02-24 四川携创信息技术服务有限公司 Data processing method for portable device
CN106055334A (en) * 2016-06-01 2016-10-26 努比亚技术有限公司 Code management system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10282275B2 (en) * 2016-09-22 2019-05-07 Microsoft Technology Licensing, Llc Method and system for managing code

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462959A (en) * 2014-12-04 2015-03-25 北京奇虎科技有限公司 Reinforcement protection method, sever and system for android app
CN105354485A (en) * 2015-10-13 2016-02-24 四川携创信息技术服务有限公司 Data processing method for portable device
CN106055334A (en) * 2016-06-01 2016-10-26 努比亚技术有限公司 Code management system and method

Also Published As

Publication number Publication date
CN109597620A (en) 2019-04-09

Similar Documents

Publication Publication Date Title
US10990367B2 (en) Application development method, tool, and device, and storage medium
US9465590B2 (en) Code generation framework for application program interface for model
CN109976793B (en) Application program running method, device, equipment and medium
CN108549538B (en) Code detection method and device, storage medium and test terminal
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
CN110764748B (en) Code calling method, device, terminal and storage medium
CN109597621B (en) Method and device for packaging Dagger, terminal equipment and storage medium
CN113126990B (en) Page development method, device, equipment and storage medium
CN111324619B (en) Object updating method, device, equipment and storage medium in micro-service system
CN112559026B (en) API (application program interface) -based native capability development method, device and storage medium
CN109597620B (en) Data processing method, device, equipment and storage medium
CN113778419B (en) Method and device for generating multimedia data, readable medium and electronic equipment
CN111176717A (en) Method and device for generating installation package and electronic equipment
CN112487331A (en) Page generation method and device, storage medium and electronic equipment
KR20070103464A (en) System and method for extensible metadata architecture for digital images
CN110007922B (en) Artificial intelligence-based graphical source code compiling method, device and equipment
CN111984300B (en) Code copying method and device, electronic equipment and computer readable storage medium
CN114371844B (en) APP development platform, APP development method and electronic equipment
CN110442419B (en) Interface layout method and device for Android application
CN112988175A (en) Cross-platform application installation package generation method, device, medium and electronic equipment
CN111124541A (en) Configuration file generation method, device, equipment and medium
CN111177089A (en) Method and device for generating log processing code, computer system and storage medium
CN113590179B (en) Plug-in detection method and device, electronic equipment and storage medium
CN115951890A (en) Method, system and device for code conversion between different front-end frames
CN113934748A (en) Mixed type SQL script file generation method, execution method and device

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