CN117933194A - Data conversion method, device, computer equipment and storage medium - Google Patents

Data conversion method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117933194A
CN117933194A CN202410095589.1A CN202410095589A CN117933194A CN 117933194 A CN117933194 A CN 117933194A CN 202410095589 A CN202410095589 A CN 202410095589A CN 117933194 A CN117933194 A CN 117933194A
Authority
CN
China
Prior art keywords
class object
target
file
binary
converted
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.)
Pending
Application number
CN202410095589.1A
Other languages
Chinese (zh)
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 Likong Yuantong Technology Co ltd
Original Assignee
Beijing Likong Yuantong 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 Likong Yuantong Technology Co ltd filed Critical Beijing Likong Yuantong Technology Co ltd
Priority to CN202410095589.1A priority Critical patent/CN117933194A/en
Publication of CN117933194A publication Critical patent/CN117933194A/en
Pending legal-status Critical Current

Links

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

The invention relates to the technical field of data conversion, and discloses a data conversion method, a data conversion device, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring a binary file to be converted, and analyzing a text in the binary file to be converted to generate a class object with binary attribute; extracting key information from the class object with the binary attribute to obtain a target class object; and converting the target class object into a target file. The invention saves the storage space and has stronger readability by converting the data with general confidentiality into the plaintext and only storing the key information therein.

Description

Data conversion method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data conversion technologies, and in particular, to a data conversion method, a data conversion device, a computer device, and a storage medium.
Background
Binary files are the most commonly used files for most programs because they are more confidential.
However, the general confidentiality data is stored by using a binary file, so that the readthrough performance is poor, and the binary file contains a large amount of useless information and occupies the storage space.
Disclosure of Invention
In view of this, the present invention provides a data conversion method, apparatus, computer device and storage medium, so as to solve the problem that the confidentiality general data is stored by using a binary file, so that the readthrough is poor, and the binary file contains a large amount of useless information, and occupies a storage space.
In a first aspect, the present invention provides a data conversion method, the method comprising:
acquiring a binary file to be converted;
Analyzing the text in the binary file to be converted to generate a class object with binary attribute;
extracting key information from the class object with the binary attribute to obtain a target class object;
and converting the target class object into a target file.
According to the data conversion method, the binary file with general confidentiality is converted into the class object in a plaintext form, key information of the class object is obtained, and the key information of the class object is stored, so that the readability of the converted target file is high, and the storage space is saved.
In an optional implementation manner, the extracting key information of the class object with the binary attribute to obtain a target class object includes:
and under the condition that the class object with the binary attribute is a basic class object, extracting key information from the basic class object to obtain a target class object.
In an optional implementation manner, the extracting key information of the class object with the binary attribute to obtain a target class object includes:
Creating a stack under the condition that the class object with the binary attribute is a complex class object;
Converting the complex class object into a plurality of basic class objects from the top layer of the complex class object, and pushing the plurality of basic class objects into the stack, wherein a hierarchical structure mark is pushed into the stack when a hierarchical structure is acquired;
Extracting key information from the plurality of basic class objects in a pop-up mode to obtain a plurality of class objects;
the plurality of class objects are merged into the target class object based on the hierarchy flag.
In an alternative embodiment, before said converting said target class object into a target file, the method further comprises:
Converting the data type conforming to a preset rule in the target class object into a character type data type to obtain a target class object to be converted;
the converting the target class object into a target file includes:
And converting the target class object to be converted into a target file.
According to the data conversion method provided by the embodiment, the general binary file with confidentiality is converted into the class object in the plaintext form, the key information of the class object is obtained, and the key information of the class object is stored, so that the readability of the converted target file is high, the storage space is saved, the target class object is updated in the storage structure, and the storage space is further saved.
In an alternative embodiment, the obtaining the binary file to be converted includes:
and determining the binary file to be converted based on the file header.
In an alternative embodiment, before said converting said target class object into a target file, the method further comprises:
adding attribute information of a target class object into the target class object to obtain a target class object to be converted;
the converting the target class object into a target file includes:
And converting the target class object to be converted into a target file.
According to the data conversion method, the binary file with general confidentiality is converted into the class object in a plaintext form, key information of the class object is obtained, and the key information of the class object is stored, so that the readability of the converted target file is high, the storage space is saved, the target class object is updated in a storage structure, the storage space is further saved, attribute information is added in the target class object, and the user can conveniently check the target class object.
In a second aspect, the present invention provides a data conversion apparatus, the apparatus comprising:
The binary file acquisition module is used for acquiring a binary file to be converted;
The binary file analysis module is used for analyzing the text in the binary file to be converted and generating a class object with binary attribute;
the target class object acquisition module is used for extracting key information from the class object with the binary attribute to obtain a target class object;
and the target class object conversion module is used for converting the target class object into a target file.
In an alternative embodiment, the target class object obtaining module includes:
and the target class object acquisition subunit is used for extracting key information from the basic class object to obtain the target class object under the condition that the class object with the binary attribute is the basic class object.
In a third aspect, the present invention provides a computer device comprising: the data conversion system comprises a memory and a processor, wherein the memory and the processor are in communication connection, the memory stores computer instructions, and the processor executes the computer instructions, so that the data conversion method of the first aspect or any corresponding implementation mode of the first aspect is executed.
In a fourth aspect, the present invention provides a computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the data conversion method of the first aspect or any of its corresponding embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a data conversion method according to an embodiment of the invention;
FIG. 2 is a flow chart of another data conversion method according to an embodiment of the invention;
fig. 3 is a block diagram of a data conversion apparatus according to an embodiment of the present invention;
Fig. 4 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Binary files are the most commonly used files for most programs because of their strong confidentiality.
The general data of confidentiality is stored by using a binary file, so that the readthrough performance is poor, and the binary file contains a large amount of useless information and occupies the storage space.
The embodiment of the invention provides a data conversion method, which achieves the effects of strong readthrough and saving storage space by converting a binary file into a plaintext and storing key information in the binary file.
According to an embodiment of the present invention, there is provided a data conversion method embodiment, it being noted that the steps shown in the flowcharts of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that herein.
In this embodiment, a data conversion method is provided, which may be used in the above mobile terminal, such as a central processing unit, a server, etc., and fig. 1 is a flowchart of a data conversion method according to an embodiment of the present invention, as shown in fig. 1, where the flowchart includes the following steps:
Step S101, obtaining a binary file to be converted.
The binary file to be converted is the binary file where the data with general confidentiality is located.
Step S102, analyzing the text in the binary file to be converted to generate a class object with binary attribute.
After the binary file to be converted is obtained, analyzing the text in the binary file to be converted to generate a class object with binary attribute.
It should be noted that binary data in the binary file to be converted is converted into a class object with binary attribute in a plaintext form.
And step S103, extracting key information from the class object with the binary attribute to obtain a target class object.
The class object with the binary attribute contains a large amount of useless information, the useless attribute of the class object is saved, the key information in the class object with the binary attribute is extracted, the useless information in the class object is removed, only the key information in the class object is reserved, and the key information forms the target class object.
Step S104, converting the target class object into a target file.
After the target class object is obtained, the target class object is converted into a target file for storage.
According to the data conversion method, the binary file with general confidentiality is converted into the class object in a plaintext form, key information of the class object is obtained, and the key information of the class object is stored, so that the readability of the converted target file is high, and the storage space is saved.
In this embodiment, a data conversion method is provided, which may be used in the above mobile terminal, such as a central processing unit, a server, etc., and fig. 2 is a flowchart of the data conversion method according to an embodiment of the present invention, as shown in fig. 2, where the flowchart includes the following steps:
Step S201, a binary file to be converted is obtained. Please refer to step S101 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S202, analyzing the text in the binary file to be converted to generate a class object with binary attribute.
Please refer to step S102 in the embodiment shown in fig. 1 in detail, which is not described herein.
And step S203, extracting key information from the class object with the binary attribute to obtain a target class object.
Please refer to step S103 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S204, converting the data type conforming to the preset rule in the target class object into a character type data type to obtain the target class object to be converted.
The object class object is updated on a storage structure, and specifically, a data type with a smaller value is converted into a character data type. Illustratively, floating point type data types are converted to character type data types for compressing storage space.
In step S205, the target class object is converted into a target file.
Specifically, the step S205 includes:
step S2051, converting the target class object to be converted into a target file.
And after the target class object to be converted is acquired, converting the target class object to be converted into a target file.
According to the data conversion method provided by the embodiment, the general binary file with confidentiality is converted into the class object in the plaintext form, the key information of the class object is obtained, and the key information of the class object is stored, so that the readability of the converted target file is high, the storage space is saved, the target class object is updated in the storage structure, and the storage space is further saved.
In some optional embodiments, the step S203 includes:
And a1, under the condition that the class object with the binary attribute is a basic class object, extracting key information from the basic class object to obtain a target class object.
The basic class object is a class object without a nested structure.
It can be understood that after the key information of the basic class object is extracted, the updating on the storage structure can be performed to obtain the target class object.
In some optional embodiments, the step S203 includes:
Step b1, in the case that the class object with the binary attribute is a complex class object, creating a stack.
The complex class object is a class object containing a nested structure.
And b2, starting from the top layer of the complex class object, converting the complex class object into a plurality of basic class objects, and pushing the plurality of basic class objects into a stack, wherein a hierarchical structure mark is pushed into the stack under the condition that the hierarchical structure is acquired.
The complex class object comprises at least one layer of nested structure, each basic class object is pressed into the stack in sequence from the top layer of the complex class object, if the complex class object encounters the hierarchical structure, a start mark of the hierarchical structure is placed into the stack when entering the hierarchical structure, and an end mark is placed into the stack when leaving the hierarchical structure.
And b3, extracting key information from the plurality of basic class objects in a pop-up mode to obtain a plurality of class objects.
After the complex class objects are completely pushed into the stack, the basic class objects in the stack are read in a pop mode, and key information of each basic class object is extracted, so that a plurality of class objects are obtained.
It should be noted that, when the stack is popped, the start flag of the hierarchical structure is encountered, the "substitution" may be used after the stack is popped, and the "substitution" may be used after the stack is popped when the end flag of the hierarchical structure is encountered.
It can be understood that after the key information extraction is performed on each basic class object, an upgrade on the storage space can be performed to obtain a plurality of class objects.
And b4, merging the plurality of class objects into a target class object based on the hierarchical structure mark.
And merging the plurality of class objects into a target class object according to the hierarchical structure start mark and the hierarchical structure end mark after popping the stack.
In some alternative embodiments, the step S201 includes:
Step c1, determining a binary file to be converted based on the file header.
In some alternative embodiments, before converting the target class object into the target file, the method further includes:
And d1, adding attribute information of the target class object into the target class object to obtain the target class object to be converted.
After the target class object is obtained, attribute information can be added into the target class object, so that the user can check the attribute information conveniently.
It should be noted that, the class object with binary attribute may be extracted from key information, upgraded on the storage structure, and the attribute information of the target class object is added to obtain the target class object to be converted.
According to the data conversion method, the binary file with general confidentiality is converted into the class object in a plaintext form, key information of the class object is obtained, and the key information of the class object is stored, so that the readability of the converted target file is high, the storage space is saved, the target class object is updated in a storage structure, the storage space is further saved, attribute information is added in the target class object, and the user can conveniently check the target class object.
The embodiment also provides a data conversion device, which is used for implementing the above embodiment and the preferred implementation manner, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The present embodiment provides a data conversion device, as shown in fig. 3, including:
the binary file obtaining module 301 is configured to obtain a binary file to be converted.
The binary file parsing module 302 is configured to parse text in a binary file to be converted, and generate a class object with binary attribute.
And the target class object acquisition module 303 is configured to extract key information from the class object with the binary attribute to obtain a target class object.
The target class object conversion module 304 is configured to convert the target class object into a target file.
In some alternative embodiments, the target class object acquisition module 303 includes:
and the target class object acquisition subunit is used for extracting key information from the basic class object to obtain the target class object under the condition that the class object with the binary attribute is the basic class object.
In some alternative embodiments, the target class object acquisition module 303 includes:
And the stack creation unit is used for creating a stack in the case that the class object with the binary attribute is a complex class object.
And the basic class object pushing unit is used for converting the complex class object into a plurality of basic class objects from the top layer of the complex class object, and pushing the plurality of basic class objects into a stack, wherein the hierarchical structure mark is pushed into the stack under the condition that the hierarchical structure is acquired.
And the class object acquisition unit is used for extracting key information of the plurality of basic class objects in a pop-up mode to obtain a plurality of class objects.
And the class object merging unit is used for merging the plurality of class objects into a target class object based on the hierarchical structure mark.
In some alternative embodiments, the apparatus further comprises:
The first target class object to be converted is used for converting the data type conforming to the preset rule in the target class object into the character type data type to obtain the target class object to be converted.
The target class object conversion module 304 includes:
and the target class object conversion subunit is used for converting the target class object to be converted into a target file.
In some alternative embodiments, the apparatus further comprises:
And the second target class object obtaining module is used for adding the attribute information of the target class object into the target class object to obtain the target class object to be converted.
In some alternative embodiments, binary acquisition module 301 includes:
and the binary file acquisition subunit is used for determining the binary file to be converted based on the file header.
Further functional descriptions of the above respective modules and units are the same as those of the above corresponding embodiments, and are not repeated here.
The data conversion device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application SPECIFIC INTEGRATED Circuit) Circuit, a processor and a memory that execute one or more software or firmware programs, and/or other devices that can provide the above functions.
The embodiment of the invention also provides computer equipment, which is provided with the data conversion device shown in the figure 3.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a computer device according to an alternative embodiment of the present invention, as shown in fig. 4, the computer device includes: one or more processors 401, memory 402, and interfaces for connecting the components, including a high-speed interface and a low-speed interface. The various components are communicatively coupled to each other using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the computer device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple computer devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 401 is illustrated in fig. 4.
The processor 401 may be a central processor, a network processor or a combination thereof. Wherein the processor 401 may further comprise a hardware chip. The hardware chip may be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general-purpose array logic, or any combination thereof.
Wherein the memory 402 stores instructions executable by the at least one processor 401 to cause the at least one processor 401 to perform the method shown in implementing the above embodiments.
Memory 402 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the computer device, etc. In addition, memory 402 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 402 may optionally include memory located remotely from processor 401, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Memory 402 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk, or solid state disk; memory 402 may also include a combination of the above types of memory.
The computer device also includes a communication interface 403 for the computer device to communicate with other devices or communication networks.
The embodiments of the present invention also provide a computer readable storage medium, and the method according to the embodiments of the present invention described above may be implemented in hardware, firmware, or as a computer code which may be recorded on a storage medium, or as original stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and to be stored in a local storage medium, so that the method described herein may be stored on such software process on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, a solid state disk or the like; further, the storage medium may also comprise a combination of memories of the kind described above. It will be appreciated that a computer, processor, microprocessor controller or programmable hardware includes a storage element that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the methods illustrated by the above embodiments.
Although embodiments of the present invention have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope of the invention as defined by the appended claims.

Claims (10)

1.A method of data conversion, the method comprising:
acquiring a binary file to be converted;
Analyzing the text in the binary file to be converted to generate a class object with binary attribute;
extracting key information from the class object with the binary attribute to obtain a target class object;
and converting the target class object into a target file.
2. The method of claim 1, wherein extracting key information from the class object with binary attribute to obtain a target class object comprises:
and under the condition that the class object with the binary attribute is a basic class object, extracting key information from the basic class object to obtain a target class object.
3. The method of claim 1, wherein extracting key information from the class object with binary attribute to obtain a target class object comprises:
Creating a stack under the condition that the class object with the binary attribute is a complex class object;
Converting the complex class object into a plurality of basic class objects from the top layer of the complex class object, and pushing the plurality of basic class objects into the stack, wherein a hierarchical structure mark is pushed into the stack when a hierarchical structure is acquired;
Extracting key information from the plurality of basic class objects in a pop-up mode to obtain a plurality of class objects;
the plurality of class objects are merged into the target class object based on the hierarchy flag.
4. The method of claim 1, further comprising, prior to said converting said target class object to a target file:
Converting the data type conforming to a preset rule in the target class object into a character type data type to obtain a target class object to be converted;
the converting the target class object into a target file includes:
And converting the target class object to be converted into a target file.
5. The method of claim 1, wherein the obtaining the binary file to be converted comprises:
and determining the binary file to be converted based on the file header.
6. The method of claim 1, further comprising, prior to said converting said target class object to a target file:
adding attribute information of a target class object into the target class object to obtain a target class object to be converted;
the converting the target class object into a target file includes:
And converting the target class object to be converted into a target file.
7. A data conversion device, the device comprising:
The binary file acquisition module is used for acquiring a binary file to be converted;
The binary file analysis module is used for analyzing the text in the binary file to be converted and generating a class object with binary attribute;
the target class object acquisition module is used for extracting key information from the class object with the binary attribute to obtain a target class object;
and the target class object conversion module is used for converting the target class object into a target file.
8. The apparatus of claim 7, wherein the target class object acquisition module comprises:
and the target class object acquisition subunit is used for extracting key information from the basic class object to obtain the target class object under the condition that the class object with the binary attribute is the basic class object.
9. A computer device, comprising:
A memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the data conversion method of any of claims 1 to 6.
10. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the data conversion method of any one of claims 1 to 6.
CN202410095589.1A 2024-01-23 2024-01-23 Data conversion method, device, computer equipment and storage medium Pending CN117933194A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410095589.1A CN117933194A (en) 2024-01-23 2024-01-23 Data conversion method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410095589.1A CN117933194A (en) 2024-01-23 2024-01-23 Data conversion method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117933194A true CN117933194A (en) 2024-04-26

Family

ID=90765985

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410095589.1A Pending CN117933194A (en) 2024-01-23 2024-01-23 Data conversion method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117933194A (en)

Similar Documents

Publication Publication Date Title
CN111061643B (en) SDK cluster compatibility detection method and device, electronic equipment and storage medium
CN110704521A (en) Interface data access method and system
CN108121539B (en) Component processing method and device
CN109284453B (en) Data downloading method and device based on PDF document, storage medium and terminal
CN111831920A (en) User demand analysis method and device, computer equipment and storage medium
CN109062906B (en) Translation method and device for program language resources
CN114090671A (en) Data import method and device, electronic equipment and storage medium
CN106126299B (en) Service plug-in processing method and device
CN112650529B (en) System and method for configurable generation of mobile terminal APP codes
CN105550179A (en) Webpage collection method and browser plug-in
CN112131202B (en) Distributed file storage and reading method, terminal device and storage medium
CN110096478B (en) Document index generation method and device
CN107025233B (en) Data feature processing method and device
CN117933194A (en) Data conversion method, device, computer equipment and storage medium
CN115794756A (en) Simulation file compression method and device, equipment and storage medium
CN107832341B (en) AGNSS user duplicate removal statistical method
CN106648618B (en) Text information generation method and device for virtual application
CN115904240A (en) Data processing method and device, electronic equipment and storage medium
CN112818129B (en) Atlas modeling system and method
CN109857991B (en) Data storage method and device and electronic equipment
CN110647753B (en) Method, device and equipment for acquiring kernel file and storage medium
CN113420025A (en) Component data processing method and device and electronic equipment
CN113656474A (en) Service data access method and device, electronic equipment and storage medium
CN109992293B (en) Method and device for assembling Android system component version information
CN116627937A (en) Font library processing method, device, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination