Data file management method, system and computer readable storage medium
1. A data file management method, comprising:
determining an operating system source of the data file;
and marking the data file according to the operating system source to obtain a target data file.
2. The method for managing data files according to claim 1, wherein the step of determining the os source of the data files comprises:
identifying keywords in the data file;
and determining the source of the operating system of the data file according to the keyword.
3. The method according to claim 1 or 2, wherein the step of marking the data file according to the operating system source specifically includes:
determining a separation mark corresponding to an operating system source;
and marking the data file according to the separation mark.
4. The data file management method of claim 1, wherein after the step of marking the data file according to the operating system source, further comprising:
and annotating the data file to obtain a target data file.
5. The data file management method according to claim 1, wherein the data file is a file encoded by the first operating system.
6. A data file management method, comprising:
acquiring a target data file;
identifying tagged data in the target data file;
determining an operating system source corresponding to the target data file according to the marking data;
decoding the target data file according to the operating system source.
7. The method according to claim 6, wherein the step of decoding the marked data file according to an operating system source specifically comprises:
and decoding the data content except the mark data in the target data file.
8. The data file management method according to claim 6, further comprising:
receiving a data request of a second operating system for a target data file;
and responding to the data request, transcoding the decoded target data file according to the second operating system, and sending the transcoded target data file to the second operating system.
9. A data file management system, comprising: the system comprises a first data file management module and a second data file management module; the first data file management module is configured to perform the steps of the data file management method of any one of claims 1 to 5, the second data file management module is configured to perform the steps of the data file management method of any one of claims 6 to 8, and the first data file management module transmits a target data file to the second data file management module.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the steps of the data file management method of any one of claims 1 to 8.
Background
In a blockchain operating system, data files are often transmitted by different operating systems, and because different operating systems adopt different codes, the data files of a first operating system are opened when being sent to a second operating system, which may be messy codes. Further, even if part of the data content may be recognized between two sets of codes, the characters which cannot be recognized are encountered, and then the garbled codes are also generated.
Meanwhile, if the data file of the first operating system includes some characters that are encoded by the second operating system as instructions to be executed, the second operating system may execute the data file and cause a system crash. Especially, in the blockchain environment, data files are usually transmitted after being encoded or encrypted, and if different operating systems cannot identify the source of the data file in the ciphertext state, the data file cannot be converted.
Therefore, there is a need in the art for a solution to the above problems.
Disclosure of Invention
The invention provides a data file management method, which aims to solve the problems of messy codes and the like which may exist in the process of transmitting data files among different operating systems. Meanwhile, the invention also provides a data file management system and a computer readable storage medium.
In a first aspect, the present invention provides a data file management method.
A data file management method, comprising:
determining an operating system source of the data file;
and marking the data file according to the operating system source to obtain a target data file.
Specifically, the step of determining the source of the operating system of the data file specifically includes:
identifying keywords in the data file;
and determining the source of the operating system of the data file according to the keyword.
Specifically, the step of marking the data file according to the operating system source specifically includes:
determining a separation mark corresponding to an operating system source;
and marking the data file according to the separation mark.
Specifically, after the step of marking the data file according to the operating system source, the method further includes:
and annotating the data file to obtain a target data file.
Specifically, the data file is a file encoded by a first operating system.
In a second aspect, the present invention provides a data file management method.
The data file management method comprises the following steps:
acquiring a target data file;
identifying tagged data in the target data file;
determining an operating system source corresponding to the target data file according to the marking data;
decoding the target data file according to the operating system source.
Specifically, the step of decoding the marked data file according to the operating system source specifically includes:
and decoding the data content except the mark data in the target data file.
Specifically, the method further comprises the following steps:
receiving a data request of a second operating system for a target data file;
and responding to the data request, transcoding the decoded target data file according to the second operating system, and sending the transcoded target data file to the second operating system.
In a third aspect, the present invention provides a data file management system.
The data file management system includes: the system comprises a first data file management module and a second data file management module; the first data file management module is configured to perform the steps of the data file management method of any one of the first aspects, the second data file management module is configured to perform the steps of the data file management method of any one of the second aspects, and the first data file management module transmits a target data file to the second data file management module.
In a fourth aspect, the invention provides a computer-readable storage medium.
The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data file management method of any one of the first or second aspects.
Compared with the prior art, the scheme of the invention has the following advantages:
in the invention, the operating system source of the data file is marked, and then decoding is carried out by utilizing the decoding protocol of the corresponding operating system during decoding, so that the problem of file compatibility of multiple operating systems in the operating system (such as a block chain system) in the states of data encryption and coding is solved, and the data file can be used in a cross-system manner.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart illustrating a data file management method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a further method for managing data files according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a data file management system according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention.
In some of the flows described in the present specification and claims and in the above figures, a number of operations are included that occur in a particular order, but it should be clearly understood that these operations may be performed out of order or in parallel as they occur herein, with the order of the operations being indicated as 101, 102, etc. merely to distinguish between the various operations, and the order of the operations by themselves does not represent any order of performance. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
In a blockchain operating system, data files are often transmitted by different operating systems, and because different operating systems adopt different codes, the data files of a first operating system are opened when being sent to a second operating system, which may be messy codes.
In the embodiment of the invention, the operating system source of the data file is marked, and then the decoding is carried out by utilizing the decoding protocol of the corresponding operating system during decoding, so that the problem of file compatibility of multiple operating systems in the operating system (such as a block chain system) in the states of data encryption and coding is solved, and the data file can be used in a cross-system manner.
Referring to fig. 1 to 3, the present invention provides a data file management system and a data file management method. The data file management system comprises a first data file management module and a second data file management module. The first data file management module is configured to perform the steps of the data file management method according to any one of the first aspect. The second data file management module is configured to perform the steps of the data file management method according to any one of the second aspect.
Referring to fig. 1, in a first aspect, the present invention provides a data file management method.
A data file management method includes step S101 and step S102. Wherein:
s101, determining an operating system source of a data file;
in the process of data file transmission, the data file may be transmitted between different operating systems, and because different operating systems may have different encoding and decoding modes, there may be a phenomenon that an error or a messy code occurs when the data file is read.
Generally, the encoding and decoding protocols are consistent for the same operating system. In the embodiment of the invention, the source of the operating system of the data file is determined and the data file is marked during the transmission process of the data file, so that in the later decoding process, the decoding protocol which should be adopted to decode the data file is known.
For example, the data file is from device 1, the operating system of device 1 is windows, and the operating system source of the data file is windows.
And S102, marking the data file according to the operating system source to obtain a target data file.
According to the embodiment of the invention, the data file is well managed by marking the operating system source of the data file, so that the operating system source of the data file is clear. In the process of managing the data files, the data files from the unified operating system can be stored in the same folder. When responding to a data request of other equipment, the data file can be transcoded to adapt to the operating system of the equipment according to the operating system of the requested equipment, so that the situations of messy codes and the like are avoided.
Specifically, the step S101 specifically includes:
identifying keywords in the data file;
and determining the source of the operating system of the data file according to the keyword.
In the embodiment of the invention, the source of the operating system of the data file is determined by identifying keywords, such as windows, linux and the like, in the data file.
Specifically, the step S102 specifically includes:
determining a separation mark corresponding to an operating system source;
and marking the data file according to the separation mark.
In the embodiment of the invention, the data file is marked by using the separation mark. After the source of the operating system is identified, a separation mark corresponding to the operating system can be obtained through table lookup, and the separation mark is marked in front of the specific content of the data file, if windows is identified, the separation mark is marked in front of the specific content, namely the windows after the mark is marked is changed into/windows; it is recognized that linux is marked with/t/t, that is, linux after marking is changed into/t/tlinux, and the separation mark is a separation symbol common to different coding rules.
The prefix before the keyword is helpful for identification, and if the separation mark is added behind the keyword, certain judgment difficulty may exist due to the problem of data length. In a preferred embodiment of the present application, the identification of the source of the operating system is achieved by identifying the keyword, and then preceding the keyword by a + prefix, i.e., the keyword + a separation marker.
Specifically, after the step S102, the method further includes:
and annotating the data file to obtain a target data file.
Optionally, a comment is added to the data file marked with a separation mark, the comment can be one of Chinese characters, a time stamp and a random number (for example, the comment expresses the time, the year and the day when the file is received for the first time), and the code of the comment is common to different coding rules.
Specifically, the data file is a file encoded by a first operating system.
In the embodiment of the invention, the data file is received from other equipment or stored on the local equipment. The data file received from another device is transmitted to the local device after being encoded, that is, the data file is a file encoded by the first operating system. The data file can also be a file encoded by the first operating system.
Optionally, the first operating system encodes the data file using BASE 64. Base64 is the encoding scheme used to transmit 8Bit byte codes.
Referring to a second aspect of fig. 2, the present invention provides a data file management method.
The data file management method includes step S201, step S202, step S203, and step S204. Wherein:
s201, acquiring a target data file;
in an embodiment of the present invention, the target data is a marked data file having an operating system source. For example, the target data file is from a windows device, encoded by the windows device using an encoding protocol, and then marked as a data file from a windows operating system using marking data during transmission.
In one possible design, the data file is marked with a separation marker.
S202, identifying mark data in the target data file;
in the present invention, the tag data in the target data file is determined. And determining an operating system source of the target data file according to the marking data.
S203, determining an operating system source corresponding to the target data file according to the marking data;
in the embodiment of the invention, after the marking data is identified, the operating system source corresponding to the marking data can be obtained through table lookup. The table is a mapping relation table between pre-established marking data and an operating system source.
And S204, decoding the target data file according to the operating system source.
And after the source of the operating system is determined, decoding the target file by using a decoding protocol corresponding to the source of the operating system.
The invention identifies the marking data in the target data file, determines the source of the operating system of the target data, and then correspondingly decodes the marking data, thereby avoiding the situations of incompatibility, messy codes and the like of the operating system.
Specifically, the step S203 specifically includes:
and decoding the data content except the mark data in the target data file.
In the embodiment of the invention, in the decoding process, the data content part of the non-identification data of the target data file is separated according to the identification data, the decoding is carried out, and the identification data content is shielded.
In one possible design, the identification data is a separation mark. The separation mark and the information behind the separation mark are masked during decoding.
Specifically, in the embodiment of the present invention, the method further includes:
receiving a data request of a second operating system for a target data file;
and responding to the data request, transcoding the decoded target data file according to the second operating system, and sending the transcoded target data file to the second operating system.
In a specific embodiment of the present invention, the second data file management module is connected to an external device. The second operating system refers to an operating system on the external device. When the external device requests the target data file from the present system, the second data file management module determines a second operating system. The data content of the target data file is then transcoded to a second operating system adapted to read or execute the content of the target data file.
Preferably, the second data file management module stores decoding protocols, transcoding protocols and the like commonly used by a plurality of operating systems, and can transcode the target data file to be adapted to different operating system devices.
Referring to FIG. 3, in a third aspect, the present invention provides a data file management system.
The data file management system includes: the system comprises a first data file management module and a second data file management module; the first data file management module is configured to perform the steps of the data file management method of any one of the first aspects, the second data file management module is configured to perform the steps of the data file management method of any one of the second aspects, and the first data file management module transmits a target data file to the second data file management module.
In the invention, the operating system source of the data file is marked, and then decoding is carried out by utilizing the decoding protocol of the corresponding operating system during decoding, so that the problem of file compatibility of multiple operating systems in the operating system (such as a block chain system) in the states of data encryption and coding is solved, and the data file can be used in a cross-system manner. Generally, the encoding and decoding protocols are consistent for the same operating system.
In the embodiment of the invention, the coding rule of the first data file management module is adapted to the first operating system; the encoding rules of the second data file management module are adapted to the second operating system. Optionally, the first data file management module and the second data file management module are both provided with multiple encoding rules.
In a particular embodiment of the invention, the first data file management module receives a data file a from the first operating system.
In one possible design, the first operating system encodes and then chains up data file a. Data file a is transferred to a native device, which may be a blockchain operating system.
In another possible design, the first data file management module marks a separation mark on the whole data file a according to different operating system sources, for example, recognizing windows is marked with a/t; it is recognized that linux is marked with/t/t, and the separation mark is a separation symbol which is used for different coding rules to cross.
The first data management module transmits the processed target data file to a second data management module of the system (which can be a block chain operating system), the second data management module separates the data content part of the data file A according to the separation identification, decodes the data content part, shields the separation mark and the information after the separation mark, transcodes the data content of the data file A to be adapted to a second operating system, and the second operating system reads or executes the content of the data file A.
Optionally, the first data management module adds a comment to the data file a marked with the separation identifier, where the comment may be one of a chinese character, a timestamp, and a random number (e.g., the date and the year when the file is received for the first time), and the code of the comment is common to different coding rules.
Optionally, the first operating system encodes the data file using BASE64 and the second data management module decodes the data file a using BASE 64.
In a fourth aspect, the invention provides a computer-readable storage medium.
The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data file management method of any one of the first or second aspects.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by hardware that is instructed to implement by a program, and the program may be stored in a readable storage medium, and the above mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
While the embodiments of the technical solutions provided by the present invention have been described in detail, for a person skilled in the art, there may be variations in the specific implementation manners and application ranges according to the ideas of the embodiments of the present invention, and in summary, the content of the present description should not be construed as limiting the present invention.