CN107896211A - Data creation method and device and data analysis method and device - Google Patents
Data creation method and device and data analysis method and device Download PDFInfo
- Publication number
- CN107896211A CN107896211A CN201711131458.0A CN201711131458A CN107896211A CN 107896211 A CN107896211 A CN 107896211A CN 201711131458 A CN201711131458 A CN 201711131458A CN 107896211 A CN107896211 A CN 107896211A
- Authority
- CN
- China
- Prior art keywords
- data
- packet
- value
- length
- read
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/565—Conversion or adaptation of application format or content
- H04L67/5651—Reducing the amount or size of exchanged application data
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention belongs to data processing field, discloses a kind of data creation method and device and data analysis method and device, and wherein data creation method includes:Obtain data value;The length of data value is calculated, generates length value;Merge the length value and the data value, generate packet.The value of present invention extraction data and the length of data, avoid unnecessary room, save memory space and transmission space.
Description
Technical field
The present invention relates to data processing field, especially relates to a kind of data creation method and device and data solution
Analyse method and apparatus.
Background technology
During the network data transmission of internet of things equipment and server, in order to ensure the integrality of packet, often
Some invalid data are carried, not only influence efficiency of transmission, and waste data traffic.Such as transmitting GPS data, valid data
For (113.9477,022.5659), wherein longitude length is 8 characters, and latitude length is 7 characters, needs 15 words altogether
Accord with length.If equipment does not get effective longitude and latitude, to ensure the uniformity of data format, 15 are still uploaded
The invalid data (000.0000,00.0000) of individual character, also account for 15 characters, and actually invalid data is not
Have in all senses, such data take up space very much in storage or transmission.
The content of the invention
The main object of the present invention for provide a kind of data creation method and device and corresponding data analysis method and
Device, space can be reduced after generation with nullified data, can rapidly be parsed after the data transfer to another server
Out.
In order to realize foregoing invention purpose, the present invention proposes that one kind utilizes data creation method, including:
Obtain data value;
The length of data value is calculated, generates length value;
Merge the length value and the data value, generate packet.
Further, the length for reading data, generation length value include:
Judge whether data are invalid datas;
If so, the length for setting the data is 0xFF.
Further, the merging length value and data value, after the step of generating packet, including:
Named according to the type of the data for the packet.
The present invention also provides a kind of data analysis method, including:
The length value of read data packet;
According to the length value of the packet, the data value that length is corresponded in the packet is parsed, after being parsed
Data.
Further, the length for reading data, the length value according to the packet, parses the packet
The data value of interior corresponding length, obtaining data value includes:
If the length value of the data read is 0xFF, jumps to next packet and parsed.
Further, include before the length value of the read data packet:
The title of the packet is read, obtains the data type of the packet.
The present invention also provides a kind of data generating device, including:
Data value module, for obtaining data value;
Length value module, for calculating the length of data value, generate length value;
Merging module, for merging the length value and the data value, generate packet;
Module is named, for being named according to the type of the data for the packet.
Further, the length value module includes:
Judging unit, for judging whether data are invalid datas;
Setting unit, if being invalid data for data, the length for setting the data is 0xFF.
The present invention also provides a kind of data analysis device, including:
Name module, for the title of read data packet, obtain the data type of the packet;
Read module, the length value for read data packet;
Parsing module, for the length value according to the packet, the data value that length is corresponded in the packet is parsed,
Data after being parsed.
Further, the read module includes:Identifying unit, the data length value for judging to read is 0xFF;
The parsing module includes:Jump-transfer unit, parsed for jumping to next packet.
Compared with prior art, the invention has the advantages that the length of the value of extraction data and data, it is unnecessary to avoid
Room, save memory space and transmission space;When what is especially generated is invalid data, substantial amounts of space can be saved;
The length value of invalid data is defined as 0xFF, further saves space.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of the data creation method of one embodiment of the invention;
Fig. 2 is the schematic flow sheet of the data creation method of one embodiment of the invention;
Fig. 3 is the schematic flow sheet of the data creation method of one embodiment of the invention;
Fig. 4 is the schematic flow sheet of the data analysis method of one embodiment of the invention;
Fig. 5 is the schematic flow sheet of the data analysis method of one embodiment of the invention;
Fig. 6 is the structural representation of the data generating device of one embodiment of the invention;
Fig. 7 is the structural representation of the data generating device of one embodiment of the invention;
Fig. 8 is the structural representation of the data analysis device of one embodiment of the invention;
Fig. 9 is the structural representation of the data analysis device of one embodiment of the invention.
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
Reference picture 1, the embodiment of the present invention provide a kind of data creation method, including step:
S3, obtain data value;
S4, the length for calculating data value, generate length value;
S5, merge the length value and the data value, generate packet;
S6, according to the type of the data be the packet name.
In the present embodiment, there are many electronic products to need real-time data collection and then upload onto the server, such as people exist
Point take out when, user want in real time concern take-away be sent to where, then need take out food delivery personnel send positional information in real time extremely
User or in real time transmission positional information to server and then user obtain the positional information by server in real time.The data are
Gps data, acquisition be food delivery personnel mobile phone longitude and latitude, such as " 113.9477 22.5659 " are exactly data.Read
The length of the data, i.e. space size shared by the data are taken, one shares 13 numerals and 3 punctuation marks, totally 16 words
Symbol.Then length value and data value are combined, generate packet, the name of wherein packet is GPS, can also be abbreviated as
G, the packet ultimately generated are " G [16] 8113.9477,22.5659 ".And if if invalid data, GPS data are just
It need not upload, be represented by " G [0xFF] ", so only occupy two bytes.(wherein [16] or [0xFF] represent ASCII numbers
Value, accounts for a byte, that is, a character).Invalid data compared to 16 characters of transmission saves very big space.
Wherein, the step of S3 and S4 can be exchanged, i.e., can also first read the data of data, then read the length generation length of data
Value, finally length value and data value are merged.
Reference picture 2, in the present embodiment, the length for reading data, generation length value S4 includes:
S41, judge whether data are invalid datas;
S42, if so, the length for setting the data is 0xFF.
In the present embodiment, the length of invalid data is arranged to 0xFF, while omits invalid data, the data ultimately produced
Bag is " G [0xFF] ", and expression does not get valid data, when sending data to other-end and carrying out generating former data, is read
It is 0xFF to get length, then directly skips, and continues to read next data, so saves read access time, and the sky taken
Between it is smaller, make data transfer faster.Judging whether data are invalid datas, can be obtained when data are obtained less than
When be just directly determined as invalid data.
Reference picture 3, in the present embodiment, the merging length value and data value, include after generating packet:
S7, packet is sent to server.
In the present embodiment, the packet after merging is sent to server, other-end and is parsed into the packet just again
Normal data, show in terminal.In point take-away situation described above, the mobile phone of food delivery personnel is taken out by the GPS of itself
Sent in real time to server after data generation, the mobile phone of user obtains the data in server in real time, then by this data solution
Gps data is analysed into, then real-time embodying can then understand the position for taking out food delivery personnel in real time on the mobile phone of user, understand outer
Sell the particular location of article.
In summary, data creation method of the invention, can be with nullified data through generating deutomerite save space, convenient storage
And transmission.
Reference picture 4, the present invention also provide a kind of data analysis method, including:
S8, the title for reading the packet, obtain the data type of the packet;
S9, read data packet length value;
S10, the length value according to the packet, parse the data value that length is corresponded in the packet, are parsed
Data afterwards.
In the present embodiment, the packet obtained according to above-mentioned data creation method is parsed, first read data packet type,
Such as packet is that " G [16] 8113.9477,22.5659 ", then read data packet claims to be " G ", illustrates the type of data and is
Gps data.Then the length 16 of read data packet, data value corresponding to 16 characters after reading, parsing packet is completed.
Reference picture 5, in the present embodiment, the length for reading data, the length value according to the packet, parsing
The data value of length is corresponded in the packet, obtaining data value includes:
S91, the length value of the data read are 0xFF;
S101, jump to next packet and parsed.
In the present embodiment, if the data read are " G [0xFF] ", after parsing, read and data length is 0xFF, say
The bright data are invalid datas, are directly skipped, and read next data, save read access time, and the space taken is small, adds
The speed of fast parsing data.
Reference picture 6, the present invention also provide a kind of data generating device, including:
Data value module 3, for obtaining data value;
Length value module 4, for calculating the length of data value, generate length value;
Merging module 5, for merging the length value and the data value, generate packet;
Module 6 is named, for being named according to the type of the data for the packet.
In the present embodiment, there are many electronic products to need real-time data collection and then upload onto the server, such as people exist
Point take out when, user want in real time concern take-away be sent to where, then need take out food delivery personnel send positional information in real time extremely
User or in real time transmission positional information to server and then user obtain the positional information by server in real time.The data are
What gps data, first data value module 3 obtained is the longitude and latitude of the mobile phone of food delivery personnel, such as " 113.9477
22.5659 " it is exactly data.Length value module 4 reads the length of the data, i.e. space size shared by the data, and one is shared
13 numerals and 3 punctuation marks, totally 16 characters, 8 bytes.Module 5 is then combined with to merge length value and data value
Come, generate packet, the name of wherein packet is GPS, can also write a Chinese character in simplified form into G, the packet ultimately generated is " G [16]
8113.9477 22.5659 ",.And if if invalid data, GPS data need not just upload, and be represented by " G
[0xFF] ", so only occupy two bytes.(wherein [16] or [0xFF] represent ASCII numerical value, account for a byte, that is, one
Individual character).Invalid data compared to 16 characters of transmission saves very big space.Wherein, the step of S3 and S4 can be with
Exchange, i.e., can also first read the data of data, then read the length generation length value of data, finally by length value and data value
Merge.After packing the data to packet, other-end is sent data packets to, name module 6 adds the name of packet,
The terminal for receiving the packet is quickly told the type of each packet, sent rapidly after conveniently being generated
Used to corresponding application program.Such as packet is the latitude and longitude information of the mobile phone of a certain user of GPS location, then names module
6 are named as the packet " GPS ".
Reference picture 7, in the present embodiment, the length value module 4 includes:
Judging unit 41, for judging whether data are invalid datas;
Setting unit 42, if being invalid data for data, the length for setting the data is 0xFF.
In the present embodiment, when it is invalid data that judging unit 41, which judges data, setting unit 42 is by the length of invalid data
Degree is arranged to 0xFF, while omits invalid data, and the packet ultimately produced is " G [0xFF] ", and expression is not got effectively
Data, when sending data to other-end and carrying out generating former data, it is 0xFF to read length, then directly skips, and continues to read
A data are removed, so save read access time, and the space taken is smaller, makes data transfer faster.Judging number
According to whether being invalid data, can be obtained when data are obtained less than when be just directly determined as invalid data.
In the present embodiment, the data generating device also includes:
Sending module, for sending the packet to server.
In the present embodiment, the packet after sending module is merged sends to server, server and solves the packet again
Normal data are analysed into, are showed in terminal.In point take-away situation described above, take out the mobile phone of food delivery personnel by itself
Gps data generation after sending module 7 by its in real time send to server, the mobile phone of user obtains the number in server in real time
According to this data then being parsed into gps data, then real-time embodying can then understand take-away food delivery in real time on the mobile phone of user
The position of personnel, understand the particular location for taking out article.
In summary, data generating device of the invention, can be with nullified data through generating deutomerite save space, convenient storage
And transmission.
Reference picture 8, the data analysis device of one embodiment of the invention is proposed, including:
Name module 7, for reading the title of the packet, obtain the data type of the packet;
Read module 8, the length value for read data packet;
Parsing module 9, for the length value according to the packet, parse the data that length is corresponded in the packet
Value, the data after being parsed.
In the present embodiment, the packet obtained according to above-mentioned data creation method is parsed, and name module 7 first reads number
According to Packet type, such as packet is that " G [16] 8113.9477,22.5659 ", then read data packet claims to be " G ", illustrates data
Type be gps data.Then the length 16 of the read data packet of read module 8,16 words after then parsing module 9 is read
Data value corresponding to symbol, complete parsing packet.
Reference picture 9, in the present embodiment, the read module 8 includes:
Identifying unit 81, the data length value for judging to read is 0xFF;
The parsing module 9 includes:
Jump-transfer unit 91, parsed for jumping to next packet.
In the present embodiment, if the data read are " G [0xFF] ", after identifying unit 81 reads the data, it is determined as nothing
Data are imitated, then after parsing module 9 parses, reads and data length is 0xFF, confirm that the data are invalid datas, jump-transfer unit 91
Directly skip, read next data, save read access time, and the space taken is small, accelerates the speed of parsing data.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the scope of the invention, every utilization
The equivalent structure or equivalent flow conversion that description of the invention and accompanying drawing content are made, or directly or indirectly it is used in other correlations
Technical field, be included within the scope of the present invention.
Claims (10)
- A kind of 1. data creation method, it is characterised in that including:Obtain data value;The length of data value is calculated, generates length value;Merge the length value and the data value, generate packet.
- 2. data creation method as claimed in claim 1, it is characterised in that the length for reading data, generate length value Including:Judge whether data are invalid datas;If so, the length for setting the data is 0xFF.
- 3. data creation method as claimed in claim 1, it is characterised in that the merging length value and data value, generate number After the step of bag, including:Named according to the type of the data for the packet.
- A kind of 4. data analysis method, it is characterised in that including:The length value of read data packet;According to the length value of the packet, the data value that length is corresponded in the packet is parsed, the data after being parsed.
- 5. data analysis method as claimed in claim 4, it is characterised in that the length for reading data, it is described according to institute The length value of packet is stated, parses the data value that length is corresponded in the packet, obtaining data value includes:If the length value of the data read is 0xFF, jumps to next packet and parsed.
- 6. data analysis method as claimed in claim 4, it is characterised in that wrapped before the length value of the read data packet Include:The title of the packet is read, obtains the data type of the packet.
- A kind of 7. data generating device, it is characterised in that including:Data value module, for obtaining data value;Length value module, for calculating the length of data value, generate length value;Merging module, for merging the length value and the data value, generate packet;Module is named, for being named according to the type of the data for the packet.
- 8. data generating device as claimed in claim 7, it is characterised in that the length value module includes:Judging unit, for judging whether data are invalid datas;Setting unit, if being invalid data for data, the length for setting the data is 0xFF.
- A kind of 9. data analysis device, it is characterised in that including:Name module, for the title of read data packet, obtain the data type of the packet;Read module, the length value for read data packet;Parsing module, for the length value according to the packet, the data value that length is corresponded in the packet is parsed, is obtained Data after parsing.
- 10. data analysis device as claimed in claim 9, it is characterised in that the read module includes:Identifying unit, the data length value for judging to read is 0xFF;The parsing module includes:Jump-transfer unit, parsed for jumping to next packet.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711131458.0A CN107896211A (en) | 2017-11-15 | 2017-11-15 | Data creation method and device and data analysis method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711131458.0A CN107896211A (en) | 2017-11-15 | 2017-11-15 | Data creation method and device and data analysis method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107896211A true CN107896211A (en) | 2018-04-10 |
Family
ID=61805326
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711131458.0A Pending CN107896211A (en) | 2017-11-15 | 2017-11-15 | Data creation method and device and data analysis method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107896211A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101221581A (en) * | 2008-01-24 | 2008-07-16 | 北京中星微电子有限公司 | Data file generation method and device |
CN103746945A (en) * | 2013-12-30 | 2014-04-23 | 上海华为技术有限公司 | Data transmission device and method |
CN103970557A (en) * | 2013-02-04 | 2014-08-06 | 中兴通讯股份有限公司 | Storage device and system starting method thereof |
CN105512234A (en) * | 2015-12-01 | 2016-04-20 | 苏州铭冠软件科技有限公司 | Cloud database data storage method |
CN106559840A (en) * | 2016-11-16 | 2017-04-05 | 北京邮电大学 | A kind of multi-protocols mixed communication method and system |
-
2017
- 2017-11-15 CN CN201711131458.0A patent/CN107896211A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101221581A (en) * | 2008-01-24 | 2008-07-16 | 北京中星微电子有限公司 | Data file generation method and device |
CN103970557A (en) * | 2013-02-04 | 2014-08-06 | 中兴通讯股份有限公司 | Storage device and system starting method thereof |
CN103746945A (en) * | 2013-12-30 | 2014-04-23 | 上海华为技术有限公司 | Data transmission device and method |
CN105512234A (en) * | 2015-12-01 | 2016-04-20 | 苏州铭冠软件科技有限公司 | Cloud database data storage method |
CN106559840A (en) * | 2016-11-16 | 2017-04-05 | 北京邮电大学 | A kind of multi-protocols mixed communication method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102065106B (en) | Web flow collator, and method and system for accessing Web page by using terminal | |
CN103595615B (en) | The method of sending and receiving of Email, terminal | |
CN104281827B (en) | Identify the method and device of Quick Response Code | |
CN1905701B (en) | Method and system for issuing network message to mobile terminal apparatus | |
CN111970353A (en) | Data processing method and device for heterogeneous equipment in Internet of things of cloud computing platform | |
CN102650990A (en) | Terminal webpage display method and system | |
CN102916991B (en) | Method, system and device for transmitting data | |
CN101926148A (en) | Method, apparatus and computer program product for providing native broadcast support for hypermedia formats and/or widgets | |
CN112817602B (en) | JSON format data transmitting and receiving method, device and medium | |
CN104683124B (en) | Terminal type recognition methods and device | |
KR101568947B1 (en) | Method and system for downloading font file | |
CN103544150B (en) | For browser of mobile terminal provides the method and system of recommendation information | |
CN102999511B (en) | A kind of page fast conversion method, device and system | |
CN102262628B (en) | Webpage segmentation method and paging server | |
CN100421414C (en) | Device and method for realizing transfer net page information in mobile terminals | |
CN107888989A (en) | A kind of interactive system and method live based on internet | |
CN107463536A (en) | A kind of method and system for realizing document in online preview server in Android device | |
CN103079194B (en) | Service adaptation method, apparatus and system | |
CN103136235A (en) | Data processing platform, data processing system and data processing method | |
CN104077323A (en) | Method and device for converting web page content to multimedia messages | |
CN101834896A (en) | Method for linking whether information by address list of mobile communication terminal and mobile communication terminal | |
CN104010279A (en) | Multimedia message browse method, system and user terminal | |
CN102883188A (en) | Method and system of downloading and playing MP4 files in real time | |
CN107896211A (en) | Data creation method and device and data analysis method and device | |
CN102571858B (en) | Data capture method and server |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180410 |