# US 2016/0253374 A1 · Data file writing method and system, and data file reading method and system

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2016/0253374 A1
- Document ID: US20160253374A1
- Status: Published application
- Kind: A1
- Application number: 15/029,547
- Filed: 2014-09-12
- Published: 2016-09-01
- Earliest claimed: 2013-10-16
- Assignees: Guangdong Alpha Animation & Culture Co., Ltd.; Guangdong Auldey Animation & Toy Co., Ltd.; Guangzhou Alpha Culture Communication Co.,Ltd
- Applicants: Beijing Qihoo Technology Company Limited; Qizhi Software (Beijing) Company Limited
- Inventors: Bing DAI; Chao ZHU; Chao WANG
- Web page: https://patentgrep.com/patent/US20160253374A1

## CPC

- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 3/0614: {Improving the reliability of storage systems}
- G06F 3/0643: {Management of files}
- G06F 3/0674: {Disk device}
- G06F 16/22: Indexing; Data structures therefor; Storage structures
- G06F 11/1441: {Resetting or repowering}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present invention discloses a data file writing method and system, and a data file reading method and system. The data file writing method is used for writing to-be-written data to a data file, and comprises: obtaining one or more piece of to-be-written data; setting a first character string; taking each piece of to-be-written data as a unit and adding the first character string in each unit, and locating the first character string at the front end of each unit for identifying each unit; and writing each unit to the data file. By the present invention, even if it occurs in the data file that a part of data is damaged, undamaged data in the data file can still be searched for to be read.

## Claims

### Claim 1

A data file writing method for writing to-be-written data to a data file, comprising:
obtaining one or more piece of to-be-written data;
setting a first character string;
taking each piece of to-be-written data as a unit and adding the first character string in each unit, and locating the first character string at the front end of each unit for identifying each unit; and
writing each unit to the data file.

### Claim 2 (depends on 1)

The data file writing method as claimed in claim 1, wherein the step of setting a first character string comprises:
extracting a plurality of characters from the one or more piece of to-be-written data to form the first character string.

### Claim 3 (depends on 2)

The data file writing method as claimed in claim 2, wherein
the plurality of characters are multiple characters with the lowest probabilities of occurrence in the one or more piece of to-be-written data.

### Claim 4 (depends on 1)

The data file writing method as claimed in claim 1, wherein before the step of writing each unit to the data file, there is further comprised:
setting one or more second character string to respectively indicate the length of the one or more piece of to-be-written data; and
adding a second character string in each unit and connecting the second character string between the first character string and the to-be-written data in each unit for indicating the length of the to-be-written data in each unit.

### Claim at position 5

-8. (canceled)

### Claim 9

A data file reading method for reading to-be-read data from a data file, the data file comprising one or more unit, each unit having a first character string at the front end, each unit further having a piece of to-be-read data, and the method comprising:
searching the data file for the first character string, wherein if one or more first character string is found, it indicates that a unit where the one or more first character string is located is found; and
reading to-be-read data in the unit according to a predetermined rule.

### Claim 10 (depends on 9)

The data file reading method as claimed in claim 9, wherein the step of searching the data file for the first character string comprises:
searching the data file for the first character string from front to back, and whenever a first character string is found, after reading of the to-be-read data in a unit where it is located is finished, continuing to search for a next first character string backwards from the to-be-read data.

### Claim 11 (depends on 10)

The data file reading method as claimed in claim 10, wherein the step of searching the data file for the first character string comprises:
reading initial multiple characters of the data file, wherein the length of the initial multiple characters is the same as that of the first character string;
comparing the initial multiple characters with the first character string;
if the two match each other, determining that the initial multiple characters are the first character string; and
if the two do not match each other, searching out a first group of characters that match the first character string backwards from the initial multiple characters and taking them as the first character string.

### Claim 12 (depends on 10)

The data file reading method as claimed in claim 10, wherein the step of searching the data file for the first character string further comprises:
after reading of a piece of to-be-read data is finished, reading successive multiple characters connected thereafter, of which the length is the same as that of the first character string;
comparing the successive multiple characters with the first character string;
if the two match each other, determining that the successive multiple characters are the first character string; and
if the two do not match each other, searching out a first group of characters that match the first character string backwards from the successive multiple characters and taking them as the first character string.

### Claim 13 (depends on 9)

The data file reading method as claimed in claim 9, wherein the step of reading to-be-read data in the unit according to a predetermined rule comprises:
reading multiple characters connected after the first character string in the unit according to a predetermined length and taking them as a second character string;
determining the data length of to-be-read data in the unit according to the second character string; and
reading multiple characters connected after the second character string according to the data length and taking them as the to-be-read data.

### Claim at position 11

-19. (canceled)

### Claim 20

A non-transitory computer readable medium having instructions stored thereon that, when executed by at least one processor, cause the at least one processor to perform following operations:
obtaining one or more piece of to-be-written data;
setting a first character string;
taking each piece of to-be-written data as a unit and adding the first character string in each unit, and locating the first character string at the front end of each unit for identifying each unit;
writing each unit to the data file;
searching the data file for the first character string, wherein if one or more first character string is found, it indicates that a unit where the one or more first character string is located is found; and
reading to-be-read data in the unit according to a predetermined rule.
