[go: up one dir, main page]

CN114547169A - Read-write method, device, equipment and storage medium for file transmission - Google Patents

Read-write method, device, equipment and storage medium for file transmission Download PDF

Info

Publication number
CN114547169A
CN114547169A CN202210121770.6A CN202210121770A CN114547169A CN 114547169 A CN114547169 A CN 114547169A CN 202210121770 A CN202210121770 A CN 202210121770A CN 114547169 A CN114547169 A CN 114547169A
Authority
CN
China
Prior art keywords
file
txt
data
protocol
service
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
CN202210121770.6A
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.)
Shenzhen Golden Axe Network Technology Co ltd
Original Assignee
Shenzhen Golden Axe 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 Shenzhen Golden Axe Network Technology Co ltd filed Critical Shenzhen Golden Axe Network Technology Co ltd
Priority to CN202210121770.6A priority Critical patent/CN114547169A/en
Publication of CN114547169A publication Critical patent/CN114547169A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the field of file transmission, and discloses a read-write method, a device, equipment and a storage medium for file transmission. The method comprises the following steps: receiving a file transmission instruction; acquiring a preset protocol rule file, accessing a service database corresponding to a file transmission instruction, and reading a TXT file corresponding to the file transmission instruction; judging whether the file transmission instruction is a data export instruction; if so, exporting the service data in the service database according to the format of a preset service data table to obtain exported service data; according to the protocol rule file, carrying out recombination processing on the service field of the exported service data to obtain exported TXT data, and writing the exported TXT data into a TXT file; if not, copying the TXT character of the TXT file to obtain a TXT character string, carrying out field matching processing on the TXT character string according to the protocol rule file to obtain a matched TXT character string set, and writing data corresponding to the matched TXT character string set in the TXT character string into a service database.

Description

Read-write method, device, equipment and storage medium for file transmission
Technical Field
The present invention relates to the field of file transmission, and in particular, to a method, an apparatus, a device, and a storage medium for reading and writing file transmission.
Background
The file communication protocol is that if different systems use the TXT file for interaction, the content and format of the file need to be defined to ensure the correctness of multiparty communication, and the protocol of the defined file is called file communication protocol. After defining a protocol between different systems, a corresponding TXT file needs to be generated according to the protocol and parsed according to the protocol, which is called generation and reading of data files.
In the prior art, corresponding codes need to be written for each protocol file, the protocol files are different, the corresponding codes are also different, and dynamic configuration cannot be performed. If the protocol file is changed, the original code is required to be modified, and the expandability is not high. And when the protocol files to be analyzed are too many, a large amount of time is consumed for analyzing the corresponding files, and manpower is wasted.
Disclosure of Invention
The invention mainly aims to solve the technical problem that the current protocol file cannot be dynamically configured and has low expansibility.
The invention provides a reading and writing method for file transmission in a first aspect, which comprises the following steps:
receiving a file transmission instruction;
acquiring a preset protocol rule file, accessing a service database corresponding to the file transmission instruction, and reading a TXT file corresponding to the file transmission instruction;
judging whether the file transmission instruction is a data export instruction;
if the data is a data export instruction, exporting the service data in the service database according to the format of a preset service data table to obtain export service data;
according to the protocol rule file, carrying out recombination processing on the service field of the exported service data to obtain exported TXT data, and writing the exported TXT data into the TXT file;
if the data is not the data export instruction, copying the TXT character of the TXT file to obtain a TXT character string, carrying out field matching processing on the TXT character string according to the protocol rule file to obtain a matched TXT character string set, and writing the data corresponding to the matched TXT character string set in the TXT character string into the service database.
Optionally, in a first implementation manner of the first aspect of the present invention, the file transmission instruction includes: extracting an address, transmitting the address, wherein the step of judging whether the file transmission instruction is a data export instruction comprises the following steps:
judging whether the transmission address of the file transmission instruction is a local path character string or not;
if the file transmission instruction is a local path character string, determining the file transmission instruction as a data export instruction;
and if the file transmission command is not the local path character string, determining that the file transmission command is not a data export command.
Optionally, in a second implementation manner of the first aspect of the present invention, the reconstructing, according to the protocol rule file, the service field of the exported service data to obtain exported TXT data, and writing the exported TXT data into the TXT file includes:
reading a protocol field of the protocol rule file;
matching the protocol field with the service field of the derived service data to obtain a mapping service field set;
based on the format setting of the protocol rule file, carrying out format conversion processing on data corresponding to a mapping service field set in the export service data to obtain export TXT data;
writing the exported TXT data to the TXT file.
Optionally, in a third implementation manner of the first aspect of the present invention, the performing, according to the protocol rule file, field matching processing on the TXT character string to obtain a matching TXT character string set, and writing data corresponding to the matching TXT character string set in the TXT character string into the service database includes:
reading a protocol field of the protocol rule file;
matching the protocol field with the TXT character string to obtain a matched TXT character string set;
and writing the data corresponding to the matched TXT character string set in the TXT character string into the service database based on the format setting of the protocol rule file.
Optionally, in a fourth implementation manner of the first aspect of the present invention, after the obtaining a preset protocol rule file, accessing a service database corresponding to the file transmission instruction, and reading a TXT file corresponding to the file transmission instruction, before the determining whether the file transmission instruction is a data export instruction, the method further includes:
and according to the format setting of the protocol rule file, carrying out recombination processing on the data format of the TXT file to obtain the TXT file conforming to the format setting.
Optionally, in a fifth implementation manner of the first aspect of the present invention, after the receiving the file transmission instruction, before the obtaining a preset protocol rule file, accessing a service database corresponding to the file transmission instruction, and reading a TXT file corresponding to the file transmission instruction, the method further includes:
judging whether the file corresponding to the file transmission instruction is in a TXT format or not;
if not, judging whether the file corresponding to the file transmission instruction has protocol regulation or not;
and if the protocol specification exists, reading the protocol specification, and processing the file transmission instruction according to the protocol specification.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the protocol rule file includes: file name rule file, file header rule file, file content rule file.
A second aspect of the present invention provides a file transfer read-write apparatus, including:
the receiving module is used for receiving a file transmission instruction;
the acquisition access module is used for acquiring a preset protocol rule file, accessing a service database corresponding to the file transmission instruction and reading a TXT file corresponding to the file transmission instruction;
the judging module is used for judging whether the file transmission instruction is a data export instruction;
the export module is used for exporting the service data in the service database according to the format of a preset service data table if the export module is a data export instruction, so as to obtain export service data;
the recombination writing-in module is used for recombining the service field of the exported service data according to the protocol rule file to obtain exported TXT data, and writing the exported TXT data into the TXT file;
and the matching writing module is used for copying the TXT character of the TXT file to obtain a TXT character string if the data export instruction is not the data export instruction, carrying out field matching processing on the TXT character string according to the protocol rule file, and writing the TXT character string into the service database.
A third aspect of the present invention provides a read-write device for file transmission, including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; and the at least one processor calls the instruction in the memory to enable the read-write equipment for the file transmission to execute the read-write method for the file transmission.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-described method for reading and writing of file transfer.
The invention is used in the field of file transmission and analysis, and maps the protocol file and the database data table in a configuration form, so that the file generation and analysis can be automatically and rapidly carried out, the corresponding analysis and generation codes do not need to be compiled aiming at the specific protocol file, and the file analysis and generation efficiency is improved.
Drawings
FIG. 1 is a diagram of an embodiment of a method for reading and writing a file transfer according to an embodiment of the present invention;
FIG. 2 is a diagram of an embodiment of a read/write apparatus for file transfer according to an embodiment of the present invention;
FIG. 3 is a diagram of another embodiment of a read/write apparatus for file transfer according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an embodiment of a read-write device for file transfer in the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a read-write method, a device, equipment and a storage medium for file transmission.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, an embodiment of a read-write method for file transmission in the embodiment of the present invention includes:
101. receiving a file transmission instruction;
in this embodiment, the file transfer instruction { a: XXXX; b: YYY where a points to the desired transfer address and B points to the desired fetch data address.
Further, after 101, before 102, the following steps may also be performed:
1011. judging whether the file corresponding to the file transmission instruction is in a TXT format or not;
1012. if not, judging whether the file corresponding to the file transmission instruction has protocol regulation or not;
1013. and if the protocol specification exists, reading the protocol specification, and processing the file transmission command according to the protocol specification.
1014. If the protocol specification does not exist, transmitting transmission failure information to a preset management port.
In the 1011-1014 step, format judgment is performed on the file to be transmitted, and for the protocol rule file which is not in the structured TXT format, such as PDF, WORD, and the like, the content of the protocol rule needs to be entered, or the content of the protocol rule is filled in the protocol rule template and automatically imported into the protocol rule parser. If the parser has the resolution protocol specification of the file such as PDF and WORD, the file can be executed as specified, and if the parser has no resolution protocol specification of the file such as PDF and WORD, the transmission failure information needs to be sent to the preset management port.
102. Acquiring a preset protocol rule file, accessing a service database corresponding to a file transmission instruction, and reading a TXT file corresponding to the file transmission instruction;
in this embodiment, the protocol rule file is read, and according to the difference of the protocol rule file, different modes are selected to enter the protocol rule into the protocol rule parser for parsing the transmission data. And accessing a service database corresponding to the file transmission instruction, and reading a TXT file corresponding to the file transmission instruction so as to read and write data into the TXT file and the service database.
Wherein the protocol rule file includes: file name rule file, file header rule file, file content rule file. The middle file name rule defines a specific generation rule of the TXT file name, and a specific protocol file can be generated or located according to the rule. Header rules generally refer to headers within a TXT file, and headers are generally a statistic of the file content. The file content rules refer to the really meaningful traffic data in the TXT file. Including the definition of line feed, the definition of field separators within a line, the type, length and meaning of the fields in a line, the order of the fields in a line, etc.
Further, after 102, before 103, the following steps may also be performed:
1021. and according to the format setting of the protocol rule file, carrying out recombination processing on the data format of the TXT file to obtain the TXT file conforming to the format setting.
At step 1021, the data format of the TXT file is unified according to the format setting of the protocol rule file, where the data format may be the arrangement order of each row and each column, the valid header data is arranged before the valid header data, and the content data is arranged after the valid header data.
103. Judging whether the file transmission instruction is a data export instruction;
in this embodiment, it is necessary to check whether the file transmission command is read or written, the data export command is to export data from the service database into the TXT file, and the non-data export command is to write the TXT data of the TXT file into the service database.
Further, at 103, the following steps may be performed:
1031. the file transmission instruction comprises: extracting an address, transmitting the address, and judging whether the file transmission instruction is a data export instruction comprises the following steps:
1032. judging whether the transmission address of the file transmission instruction is a local path character string or not;
1033. if the local path character string is the local path character string, determining the file transmission instruction as a data export instruction;
1034. and if the file transmission command is not the local path character string, determining that the file transmission command is not the data export command.
In step 1031-: XXXX; b: YYY, XXXX pointed by A is a transmission address, and YYY pointed by B is a fetch address. And judging whether XXXX is a path character string of a local disk or a memory, if so, indicating that a TXT file needs to be transmitted to a local path, wherein the file transmission instruction is a data export instruction. If the path is not a local path, the indication points to a network link, and the file transfer instruction is not a data export instruction.
104. If the data is a data export instruction, exporting the service data in the service database according to the format of a preset service data table to obtain export service data;
in this embodiment, the format of the service data table is not necessarily a protocol format, and the service data to be exported is exported first, and can be written into the TXT file after format conversion.
105. According to the protocol rule file, carrying out recombination processing on the service field of the exported service data to obtain exported TXT data, and writing the exported TXT data into a TXT file;
in this embodiment, the protocol format convention solver of the protocol rule file writes the entered protocol rule content into the protocol configuration database. For use by subsequent protocol field mappers. And reading the configured protocol rule data from the protocol configuration database by the protocol field mapper, and dynamically generating the mapping relation between the protocol rule and the service database table. And the protocol field mapper automatically generates or updates a corresponding service data table by comparing the newly generated mapping relation with the field of the existing service database, determines the updated service data table as TXT data, and writes the TXT data into a TXT file.
Further, at 105, the following steps may be performed:
1051. reading a protocol field of a protocol rule file;
1052. matching the protocol field with the service field of the derived service data to obtain a mapping service field set;
1053. based on the format setting of the protocol rule file, carrying out format conversion processing on data corresponding to a mapping service field set in the export service data to obtain export TXT data;
1054. the exported TXT data is written to a TXT file.
In the step 1051 plus 1054, the service system writes the specific service data into the service database, the protocol field mapper takes out the corresponding service data from the service database, converts the service data into the corresponding field in the TXT file according to the mapping, and delivers the field to the protocol file reading generator. The protocol file reading generator converts the received data into TXT data, and writes the TXT data into a TXT file.
106. If the data is not the data export instruction, copying the TXT character of the TXT file to obtain a TXT character string, carrying out field matching processing on the TXT character string according to the protocol rule file to obtain a matched TXT character string set, and writing data corresponding to the matched TXT character string set in the TXT character string into a service database.
In this implementation, the TXT characters need to be copied according to the sequence, the TXT character strings of the contents of the TXT file are taken, the protocol fields for guidance in the protocol rule file are matched with the TXT character strings one by one, the matched TXT character strings in the TXT character strings are taken, and then the entity contents corresponding to the matched TXT character strings are written into the service database according to the guidance mapping relationship.
1061. According to the protocol rule file, performing field matching processing on the TXT character string to obtain a matched TXT character string set, and writing data corresponding to the matched TXT character string set in the TXT character string into a service database, wherein the data comprises the following steps:
1062. reading a protocol field of a protocol rule file;
1063. matching the protocol field with the TXT string to obtain a matched TXT string set;
1064. and writing the data corresponding to the matched TXT character string set in the TXT character string into a service database based on the format setting of the protocol rule file.
In the 1061-1064 step, there is a service database corresponding to the protocol data, and the TXT file reads specific data and writes the data into the service database. And the protocol file reading generator reads the corresponding TXT file according to the file name mapping rule stored in the protocol field mapper. And the protocol file reading generator transmits the read data to a protocol field mapper and analyzes the specific service data according to a corresponding mapping rule. The protocol field mapper writes the service data into a service database for a specific service system to read the service data.
The invention is used in the field of file transmission and analysis, and maps the protocol file and the database data table in a configuration form, so that the file generation and analysis can be automatically and rapidly carried out, the corresponding analysis and generation codes do not need to be compiled aiming at the specific protocol file, and the file analysis and generation efficiency is improved.
The above describes the read-write method for file transmission in the embodiment of the present invention, and the following describes the read-write apparatus for file transmission in the embodiment of the present invention, with reference to fig. 2, an embodiment of the read-write apparatus for file transmission in the embodiment of the present invention includes:
a receiving module 201, configured to receive a file transmission instruction;
the obtaining and accessing module 202 is configured to obtain a preset protocol rule file, access a service database corresponding to the file transmission instruction, and read a TXT file corresponding to the file transmission instruction;
the judging module 203 is configured to judge whether the file transmission instruction is a data export instruction;
a exporting module 204, configured to export the service data in the service database according to a format of a preset service data table if the data export instruction is a data export instruction, so as to obtain export service data;
a reassembly write module 205, configured to perform reassembly processing on the service field of the exported service data according to the protocol rule file to obtain exported TXT data, and write the exported TXT data into the TXT file;
and the matching writing module 206 is configured to copy the TXT character of the TXT file to obtain a TXT character string if the data export instruction is not the data export instruction, perform field matching processing on the TXT character string according to the protocol rule file, and write the TXT character string into the service database.
The invention is used in the field of file transmission and analysis, and maps the protocol file and the database data table in a configuration form, so that the file generation and analysis can be automatically and rapidly carried out, the corresponding analysis and generation codes do not need to be compiled aiming at the specific protocol file, and the file analysis and generation efficiency is improved.
Referring to fig. 3, in another embodiment of the read/write apparatus for file transmission according to the embodiment of the present invention, the read/write apparatus for file transmission includes:
a receiving module 201, configured to receive a file transmission instruction;
the obtaining and accessing module 202 is configured to obtain a preset protocol rule file, access a service database corresponding to the file transmission instruction, and read a TXT file corresponding to the file transmission instruction;
the judging module 203 is configured to judge whether the file transmission instruction is a data export instruction;
a exporting module 204, configured to export the service data in the service database according to a format of a preset service data table if the data export instruction is a data export instruction, so as to obtain export service data;
a reassembly write module 205, configured to perform reassembly processing on the service field of the exported service data according to the protocol rule file to obtain exported TXT data, and write the exported TXT data into the TXT file;
and the matching writing module 206 is configured to copy the TXT character of the TXT file to obtain a TXT character string if the data export instruction is not the data export instruction, perform field matching processing on the TXT character string according to the protocol rule file, and write the TXT character string into the service database.
The file transmission read-write device further includes a formatting module 207, where the formatting module 207 is specifically configured to:
and according to the format setting of the protocol rule file, carrying out data format recombination processing on the TXT file to obtain the TXT file conforming to the format setting.
The read-write device for file transmission further includes a format determining module 208, where the format determining module 208 is specifically configured to:
judging whether the file corresponding to the file transmission instruction is in a TXT format or not;
if not, judging whether the file corresponding to the file transmission instruction has protocol regulation or not;
and if the protocol specification exists, reading the protocol specification, and processing the file transmission instruction according to the protocol specification.
If the protocol specification does not exist, transmitting transmission failure information to a preset management port.
The matching writing module 206 is specifically configured to:
reading a protocol field of the protocol rule file;
matching the protocol field with the TXT character string to obtain a matched TXT character string set;
and writing the data corresponding to the matched TXT character string set in the TXT character string into the service database based on the format setting of the protocol rule file.
The reassembly module 205 is specifically configured to:
reading a protocol field of the protocol rule file;
matching the protocol field with the service field of the derived service data to obtain a mapping service field set;
based on the format setting of the protocol rule file, carrying out format conversion processing on data corresponding to a mapping service field set in the export service data to obtain export TXT data;
writing the exported TXT data to the TXT file.
Wherein the file transfer instruction comprises: extract address, transmit address, the determining module 203 has:
judging whether the transmission address of the file transmission instruction is a local path character string or not;
if the file is a local path character string, determining the file transmission instruction as a data export instruction;
and if the file transmission command is not the local path character string, determining that the file transmission command is not a data export command.
The invention is used in the field of file transmission and analysis, and maps the protocol file and the database data table in a configuration form, so that the file generation and analysis can be automatically and rapidly carried out, the corresponding analysis and generation codes do not need to be compiled aiming at the specific protocol file, and the file analysis and generation efficiency is improved.
Fig. 2 and fig. 3 describe the read-write apparatus for file transfer in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the read-write apparatus for file transfer in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 4 is a schematic structural diagram of a read-write device for file transfer according to an embodiment of the present invention, where the read-write device 400 for file transfer may have relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 410 (e.g., one or more processors) and a memory 420, and one or more storage media 430 (e.g., one or more mass storage devices) for storing applications 433 or data 432. Memory 420 and storage medium 430 may be, among other things, transient or persistent storage. The program stored on the storage medium 430 may include one or more modules (not shown), each of which may include a series of instruction operations in the read/write apparatus 400 for file transfer. Further, the processor 410 may be configured to communicate with the storage medium 430, and execute a series of instruction operations in the storage medium 430 on the read-write device 400 for file transfer.
The file transfer based reader device 400 may also include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input-output interfaces 460, and/or one or more operating systems 431, such as Windows Server, Mac OS X, Unix, Linux, Free BSD, etc. It will be understood by those skilled in the art that the file transfer based reader/writer configuration shown in fig. 4 does not constitute a limitation of file transfer based reader/writer devices, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and may also be a volatile computer-readable storage medium, where instructions are stored, and when the instructions are executed on a computer, the instructions cause the computer to execute the steps of the read-write method for file transmission.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses, and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A reading and writing method for file transmission is characterized by comprising the following steps:
receiving a file transmission instruction;
acquiring a preset protocol rule file, accessing a service database corresponding to the file transmission instruction, and reading a TXT file corresponding to the file transmission instruction;
judging whether the file transmission instruction is a data export instruction;
if the business data is a data export instruction, exporting the business data in the business database according to the format of a preset business data table to obtain exported business data;
according to the protocol rule file, carrying out recombination processing on the service field of the exported service data to obtain exported TXT data, and writing the exported TXT data into the TXT file;
if the data is not the data export instruction, copying the TXT character of the TXT file to obtain a TXT character string, carrying out field matching processing on the TXT character string according to the protocol rule file to obtain a matched TXT character string set, and writing the data corresponding to the matched TXT character string set in the TXT character string into the service database.
2. The method for reading and writing file transfer according to claim 1, wherein the file transfer instruction comprises: extracting an address, transmitting the address, wherein the step of judging whether the file transmission instruction is a data export instruction comprises the following steps:
judging whether the transmission address of the file transmission instruction is a local path character string or not;
if the file transmission instruction is a local path character string, determining the file transmission instruction as a data export instruction;
and if the file transmission command is not the local path character string, determining that the file transmission command is not a data export command.
3. The method according to claim 1, wherein the reconstructing the service field of the exported service data according to the protocol rule file to obtain exported TXT data, and writing the exported TXT data into the TXT file comprises:
reading a protocol field of the protocol rule file;
matching the protocol field with the service field of the derived service data to obtain a mapping service field set;
based on the format setting of the protocol rule file, carrying out format conversion processing on data corresponding to a mapping service field set in the export service data to obtain export TXT data;
writing the exported TXT data to the TXT file.
4. The method according to claim 1, wherein the performing field matching processing on the TXT string according to the protocol rule file to obtain a matching TXT string set, and writing data corresponding to the matching TXT string set in the TXT string into the service database includes:
reading a protocol field of the protocol rule file;
matching the protocol field with the TXT character string to obtain a matched TXT character string set;
and writing the data corresponding to the matched TXT character string set in the TXT character string into the service database based on the format setting of the protocol rule file.
5. The method according to claim 1, wherein after the obtaining a preset protocol rule file, accessing a service database corresponding to the file transmission instruction, and reading a TXT file corresponding to the file transmission instruction, and before the determining whether the file transmission instruction is a data export instruction, the method further comprises:
and according to the format setting of the protocol rule file, carrying out recombination processing on the data format of the TXT file to obtain the TXT file conforming to the format setting.
6. The method according to claim 1, wherein after the file transmission instruction is received, before the obtaining a preset protocol rule file, accessing a service database corresponding to the file transmission instruction, and reading a TXT file corresponding to the file transmission instruction, the method further comprises:
judging whether the file corresponding to the file transmission instruction is in a TXT format or not;
if not, judging whether the file corresponding to the file transmission instruction has protocol regulation or not;
and if the protocol specification exists, reading the protocol specification, and processing the file transmission instruction according to the protocol specification.
If the protocol specification does not exist, transmitting transmission failure information to a preset management port.
7. Method for reading and writing a file transfer according to any one of claims 1 to 6, characterized in that said protocol rules file comprises: file name rule file, file header rule file and file content rule file.
8. A file transmission read-write device is characterized by comprising:
the receiving module is used for receiving a file transmission instruction;
the acquisition access module is used for acquiring a preset protocol rule file, accessing a service database corresponding to the file transmission instruction and reading a TXT file corresponding to the file transmission instruction;
the judging module is used for judging whether the file transmission instruction is a data export instruction;
the export module is used for exporting the service data in the service database according to the format of a preset service data table if the export module is a data export instruction, so as to obtain export service data;
the recombination writing-in module is used for recombining the service field of the exported service data according to the protocol rule file to obtain exported TXT data, and writing the exported TXT data into the TXT file;
and the matching writing module is used for copying the TXT character of the TXT file to obtain a TXT character string if the data export instruction is not the data export instruction, carrying out field matching processing on the TXT character string according to the protocol rule file, and writing the TXT character string into the service database.
9. A file transfer read-write device is characterized by comprising: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invokes the instructions in the memory to cause the read-write device of the file transfer to perform the read-write method of the file transfer according to any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements a method for reading and writing a file transfer according to any one of claims 1 to 7.
CN202210121770.6A 2022-02-09 2022-02-09 Read-write method, device, equipment and storage medium for file transmission Pending CN114547169A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210121770.6A CN114547169A (en) 2022-02-09 2022-02-09 Read-write method, device, equipment and storage medium for file transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210121770.6A CN114547169A (en) 2022-02-09 2022-02-09 Read-write method, device, equipment and storage medium for file transmission

Publications (1)

Publication Number Publication Date
CN114547169A true CN114547169A (en) 2022-05-27

Family

ID=81672707

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210121770.6A Pending CN114547169A (en) 2022-02-09 2022-02-09 Read-write method, device, equipment and storage medium for file transmission

Country Status (1)

Country Link
CN (1) CN114547169A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116915895A (en) * 2023-06-07 2023-10-20 华能南京金陵发电有限公司 Hart equipment control method, device, system and equipment based on mobile phone

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116915895A (en) * 2023-06-07 2023-10-20 华能南京金陵发电有限公司 Hart equipment control method, device, system and equipment based on mobile phone

Similar Documents

Publication Publication Date Title
US6836890B1 (en) Methods and systems for message translation and parsing of data structures in a distributed component architecture
CN112287009A (en) Interface calling and interface data warehousing method, device, equipment and storage medium
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
CN113312108B (en) SWIFT message verification method and device, electronic equipment and storage medium
US20040221275A1 (en) Apparatus and method for modifying a kernel module to run on multiple kernel versions
US12225098B2 (en) Systems and methods for data exchange among network devices
CN114500690A (en) Interface data processing method and device, electronic equipment and storage medium
CN104750463B (en) A kind of developing plug method and system
CN116346961B (en) Financial message processing method and device, electronic equipment and storage medium
CN108563629A (en) A kind of daily record resolution rules automatic generation method and device
CN112347165A (en) Log processing method and device, server and computer readable storage medium
CN113887182A (en) Table generation method, device, equipment and storage medium
US20010051974A1 (en) Method and apparatus for automatic generation of data interfaces
CN111782882B (en) A TCP message conversion method, device, system and computer storage medium
CN114547169A (en) Read-write method, device, equipment and storage medium for file transmission
US10956659B1 (en) System for generating templates from webpages
CN114218318B (en) Data processing system and method for electric power big data
CN111708542B (en) Test case generation method, system, equipment and storage medium
CN112363939A (en) Method, system and equipment for quickly generating fuzzy test network protocol template
CN117499380A (en) Custom protocol data acquisition method
CN114461193B (en) Method, device, equipment and storage medium for generating communication protocol code
US7437714B1 (en) Category partitioning markup language and tools
US7555565B2 (en) Method of translating a message from a first markup language into a second markup language
CN110853327B (en) Ship cabin equipment data field debugging and collecting method and device based on single chip microcomputer
CN114500666A (en) XML-based custom message general method and device and electronic equipment

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