CN102110152A - Writing method for channel data and reading method for file header of channel data - Google Patents
Writing method for channel data and reading method for file header of channel data Download PDFInfo
- Publication number
- CN102110152A CN102110152A CN2011100405057A CN201110040505A CN102110152A CN 102110152 A CN102110152 A CN 102110152A CN 2011100405057 A CN2011100405057 A CN 2011100405057A CN 201110040505 A CN201110040505 A CN 201110040505A CN 102110152 A CN102110152 A CN 102110152A
- Authority
- CN
- China
- Prior art keywords
- file
- read
- attribute
- length
- channel data
- 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.)
- Granted
Links
Images
Abstract
The invention discloses a reading method for channel data and a reading method for a file header of the channel data. The writing method comprises the following steps of: writing the data part of the channel data into a file; writing the attribute region of the file header part of the channel data into the file; and writing the mark region of the file header part of the channel data into the file. Because the file header part is placed at the tail of the file and when the file header part is modified, all information of the file header part can be read into a memory, and the file header information in the memory is written back to the file after new information is added; because the data part of the channel data file is in the front of the whole file, the data part does not need to be moved when the file header part is modified; and because the file header part is generally small and when a written disk is stored, the time consumption is low, the efficiency is high, and the universality and the expansibility of the file are increased.
Description
Technical field
The present invention relates to a kind of channel data treatment technology, relate in particular to the read method of the file header of a kind of wiring method of channel data and this channel data.
Background technology
Hardware device collection site physical signalling (such as pressure, voltage, electric current etc.) is used in industry and test field, will gather the data of coming then and be kept at (normally in the disk of computing machine) on the storage medium.For the data acquisition signal source at scene, we are referred to as passage.
At present, exist considerable collecting device and product on the market, the channel data that these equipment collect, the preservation form is varied, the characteristics of these data layouts be form fix, not general, extensibility is not strong, in general channel data, usually file header is positioned at the foremost of whole file, and then then preserves the data value of passage.If revised file head and increase the words of attribute information, it is big that the file header storage space becomes, and will cause the channel data value district of file header back to move after integral body on the storage medium, when data volume is bigger, this can be an operating process very consuming time, and efficient is lower.
Summary of the invention
The object of the present invention is to provide the read method of the file header of a kind of wiring method of channel data and this channel data, to improve the extensibility of channel data, the operating efficiency when improving the revised file head and increasing attribute information.
For achieving the above object, the invention provides the wiring method that a kind of channel data is provided on the one hand, may further comprise the steps:
At first the data division with channel data writes file;
Secondly the file header attribute area partly with described channel data writes described file, and is specific as follows
Write the sign of 4 bytes, described sign write down at least attribute whether as seen, whether read-only;
Write the type information of 4 bytes, the value type of described type information representation attribute;
Writing the length of Property Name, is a character string;
Writing the length of attribute display title, is a character string;
Writing the length of the attribute remark information of 4 bytes, is a character string;
The length of the value of writing, the variable-length of described value;
Write the content of described value;
File header logo area partly with described channel data writes described file at last.
The wiring method of channel data of the present invention, described logo area comprise data type, the FileVersion of the reference position of described attribute area and the deviation post in described file thereof, described data division, the marking head of described file.
On the other hand, the present invention also provides a kind of read method of file header of channel data, may further comprise the steps:
(1), reads the logo area of the file header of file;
(2), analyze described logo area, obtain the deviation post of the attribute area of described file header;
(3), read attribute area information, specific as follows according to the deviation post of described attribute area
(301), read the flag information of 4 bytes;
(302), read the type information of 4 bytes;
(303), read the title length of 4 bytes, according to this length, read the name character string;
(304), read the display Name length of 4 bytes, according to this length, reading displayed name character string;
(305), read the remark information length of 4 bytes, according to this length, read remark information;
(306), the length of read value, length and attribute type according to value read property value.
The read method of the file header of the channel data of stating of the present invention when described attribute area comprises a plurality of attribute, in step (3) afterwards, also comprises the steps:
(4), repeating step (3) reads next attribute after having read an attribute, read until all properties of described attribute area and finish.
The wiring method of channel data of the present invention is partly deposited in the file header of channel data file the back of whole channel data file, like this when the revised file head part, can earlier top of file be divided all information to read in internal memory, after adding fresh information, again the file header information in the internal memory is write back in the file, and because since the data division of channel data file in the front of whole file, so do not need the mobile data part during our revised file head part, and, the file header part is smaller usually, preserves when writing disk, and is seldom consuming time, efficient is higher, thereby has increased the versatility and the extendability of file.And wiring method from channel data of the present invention, the interior attribute of attribute area that can learn the file header part of the channel data that last preservation is got off is a kind of structure of self-described, when when reading file header, can read length earlier, read the content of designated length again.Like this, this length of several just need not be pre-fixed, and it can preserve elongated content according to actual conditions, and this just makes that the size of each attribute is unfixing, has promptly saved the space, has dirigibility again.
Description of drawings
Fig. 1 is the wiring method process flow diagram of channel data of the present invention;
Fig. 2 is the file format structure synoptic diagram of channel data of the present invention;
Fig. 3 is the structural representation of the file header attribute area partly of channel data of the present invention;
Fig. 4 is the structural representation of single attribute in the attribute area of file header part of channel data of the present invention;
Fig. 5 is the read method process flow diagram of the file header of channel data of the present invention.
Embodiment
Below in conjunction with accompanying drawing the specific embodiment of the present invention is described in detail:
With reference to shown in Figure 1, the wiring method of channel data of the present invention may further comprise the steps:
Step 1, at first the data division with channel data writes file.
(201), write the sign of 4 bytes, wherein, sign write down attribute whether as seen, information such as read-only whether.
(202), write the type information of 4 bytes, the value type of the type information representation attribute.
(203), write the length of Property Name, before writing, obtain the length (calculating by byte) of Property Name character string earlier, write length information then, this is the integer of 4 bytes.
(204), write the length of attribute display title, before writing, obtain the length of attribute display name character string earlier, write length information then, this also is the integer of 4 bytes.
(205), writing the length of the attribute remark information of 4 bytes, is a character string.
(206), the length of the value of writing, if value is a character string, then length is variable.
(207), the content of the value of writing.
Thereby obtain the file of a file layout as shown in Figure 2, comprise three parts: first is that document body is a data division, second portion and third part are the file header part, wherein second portion is the attribute area of file header part, and third part is the logo area of file header part, and logo area comprises data type (4 byte), the FileVersion (4 byte) of the reference position (4 byte) of attribute area and deviation post hereof (4 byte) thereof, data division, the marking head (4 byte) of file.Wherein, as shown in Figure 4, the attribute area of file header part can have a plurality of attributes (such as statistical information and other various channel attributes values of the acquisition time of passage, tunnel name, passage unit, passage), and each attribute in the attribute area is independent of each other, the structure of each attribute wherein then as shown in Figure 3, the internal information of single attribute can be modified, and also can add and delete property, when preserving after the attribute modification, can be written in the file with aforesaid method.When writing file, owing to be to write in the data division back of whole file, so can not influence the data division of front.
With reference to shown in Figure 5, the read method of the file header of channel data of the present invention may further comprise the steps:
Step 1 reads the logo area of the file header of file.
(301), read the flag information of 4 bytes.
(302), read the type information of 4 bytes.
(303), read the title length of 4 bytes, according to this length, read the name character string.
(304), read the display Name length of 4 bytes, according to this length, reading displayed name character string.
(305), read the remark information length of 4 bytes, according to this length, read remark information.
(306), the length of read value, length and attribute type according to value read property value.
Step 4, repeating step 3 reads down next attribute in the attribute area after having read an attribute, reads until all properties of attribute area and finishes.Because the single attribute in the attribute area all is structures of self-described, such as several of title, display Name, remarks and values etc., when reading, can read length earlier as can be seen, reads the content of designated length again.It can preserve elongated content according to actual conditions, and this just makes that the size of each attribute is unfixing, has promptly saved the space, has dirigibility again.
Above embodiment is described preferred implementation of the present invention; be not that scope of the present invention is limited; design under the prerequisite of spirit not breaking away from the present invention; various distortion and improvement that the common engineering technical personnel in this area make technical scheme of the present invention all should fall in the definite protection domain of claims of the present invention.
Claims (4)
1. the wiring method of a channel data is characterized in that, may further comprise the steps:
At first the data division with channel data writes file;
Secondly the file header attribute area partly with described channel data writes described file, and is specific as follows
Write the sign of 4 bytes, described sign write down at least attribute whether as seen, whether read-only;
Write the type information of 4 bytes, the value type of described type information representation attribute;
Writing the length of Property Name, is a character string;
Writing the length of attribute display title, is a character string;
Writing the length of the attribute remark information of 4 bytes, is a character string;
The length of the value of writing, the variable-length of described value;
Write the content of described value;
File header logo area partly with described channel data writes described file at last.
2. the wiring method of channel data according to claim 1, it is characterized in that described logo area comprises data type, the FileVersion of the reference position of described attribute area and the deviation post in described file thereof, described data division, the marking head of described file.
3. the read method of the file header of a channel data is characterized in that, may further comprise the steps:
(1), reads the logo area of the file header of file;
(2), analyze described logo area, obtain the deviation post of the attribute area of described file header;
(3), read attribute area information, specific as follows according to the deviation post of described attribute area:
(301), read the flag information of 4 bytes;
(302), read the type information of 4 bytes;
(303), read the title length of 4 bytes, according to this length, read the name character string;
(304), read the display Name length of 4 bytes, according to this length, reading displayed name character string;
(305), read the remark information length of 4 bytes, according to this length, read remark information;
(306), the length of read value, length and attribute type according to value read property value.
4. the read method of the file header of channel data according to claim 3 is characterized in that, when described attribute area comprises a plurality of attribute, in step (3) afterwards, also comprises the steps:
(4), repeating step (3) reads next attribute after having read an attribute, read until all properties of described attribute area and finish.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201110040505 CN102110152B (en) | 2011-02-18 | 2011-02-18 | Writing method for channel data and reading method for file header of channel data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201110040505 CN102110152B (en) | 2011-02-18 | 2011-02-18 | Writing method for channel data and reading method for file header of channel data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102110152A true CN102110152A (en) | 2011-06-29 |
CN102110152B CN102110152B (en) | 2013-06-05 |
Family
ID=44174313
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201110040505 Active CN102110152B (en) | 2011-02-18 | 2011-02-18 | Writing method for channel data and reading method for file header of channel data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102110152B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109558113A (en) * | 2018-11-28 | 2019-04-02 | 偶忆科技(深圳)有限公司 | A kind of representation method of data field, device and electronic equipment |
CN110767304A (en) * | 2019-09-25 | 2020-02-07 | 广东宝莱特医用科技股份有限公司 | Method and device for circularly storing data for hemodialysis device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5832526A (en) * | 1996-01-24 | 1998-11-03 | Symantec Corporation | Method and apparatus using slack area of file storage structures for file reconstruction |
CN101169628A (en) * | 2007-11-14 | 2008-04-30 | 中控科技集团有限公司 | Data storage method and device |
CN101382876A (en) * | 2008-10-07 | 2009-03-11 | 北京创毅视讯科技有限公司 | Data storage method |
-
2011
- 2011-02-18 CN CN 201110040505 patent/CN102110152B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5832526A (en) * | 1996-01-24 | 1998-11-03 | Symantec Corporation | Method and apparatus using slack area of file storage structures for file reconstruction |
CN101169628A (en) * | 2007-11-14 | 2008-04-30 | 中控科技集团有限公司 | Data storage method and device |
CN101382876A (en) * | 2008-10-07 | 2009-03-11 | 北京创毅视讯科技有限公司 | Data storage method |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109558113A (en) * | 2018-11-28 | 2019-04-02 | 偶忆科技(深圳)有限公司 | A kind of representation method of data field, device and electronic equipment |
CN109558113B (en) * | 2018-11-28 | 2021-07-30 | 偶忆科技(深圳)有限公司 | Data field representation method and device and electronic equipment |
CN110767304A (en) * | 2019-09-25 | 2020-02-07 | 广东宝莱特医用科技股份有限公司 | Method and device for circularly storing data for hemodialysis device |
Also Published As
Publication number | Publication date |
---|---|
CN102110152B (en) | 2013-06-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102841860B (en) | A kind of big data quantity information storage and inquire method | |
CN104238962A (en) | Method and device for writing data into cache | |
CN107273304A (en) | A kind of method and solid state hard disc for improving solid state hard disc order reading performance | |
CN104679495B (en) | software identification method and device | |
CN102110152B (en) | Writing method for channel data and reading method for file header of channel data | |
CN107562644A (en) | A kind of compression method of solid-state hard disc mapping table | |
US20130151752A1 (en) | Bit-level memory controller and a method thereof | |
CN104376099A (en) | Flash-memory-based file system implementation method and device | |
CN103593483A (en) | Search method for flash courseware knowledge points | |
CN102193873B (en) | Method of quickly reading and writing mass data file | |
CN105302780B (en) | A kind of SCD file edit methods of optimization | |
CN107122140A (en) | A kind of file intelligent storage method based on metadata information | |
CN106802958A (en) | Conversion method and system of the CAD data to GIS data | |
CN111897675B (en) | Method for restoring recently deleted files of F2FS file system at mobile phone end | |
CN109684124B (en) | Method for repairing read-only fault of firmware of Western digital hard disk | |
CN105260130B (en) | A kind of reading/writing method of Seagate hard-disk system file | |
CN103049387B (en) | A kind of Compression manager method of Fragmentation device and device | |
CN104536947A (en) | Layout document processing method and device | |
CN104183006A (en) | Dynamic mapping method based on Web3D model | |
CN106648990B (en) | A kind of method of data in rapidly extracting BlueSky File System Watcher equipment | |
CN103049388B (en) | A kind of Compression manager method of Fragmentation device and device | |
CN111984600B (en) | File aggregation method, device, equipment and readable storage medium | |
CN105760313A (en) | Data processing method and device for SPI-Flash-based (Serial Peripheral Interface-Flash-based) file system | |
KR101338566B1 (en) | Apparatus and method for classifying i/o feature for disk drive | |
CN110457239B (en) | Method for extracting solid state disk basic key |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |