CN101763436A - File packing method and tool - Google Patents

File packing method and tool Download PDF

Info

Publication number
CN101763436A
CN101763436A CN201010112333A CN201010112333A CN101763436A CN 101763436 A CN101763436 A CN 101763436A CN 201010112333 A CN201010112333 A CN 201010112333A CN 201010112333 A CN201010112333 A CN 201010112333A CN 101763436 A CN101763436 A CN 101763436A
Authority
CN
China
Prior art keywords
file
treatment
packaging file
information
packaging
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
Application number
CN201010112333A
Other languages
Chinese (zh)
Other versions
CN101763436B (en
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 Ipanel TV Inc
Original Assignee
Shenzhen Ipanel TV Inc
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 Ipanel TV Inc filed Critical Shenzhen Ipanel TV Inc
Priority to CN2010101123335A priority Critical patent/CN101763436B/en
Publication of CN101763436A publication Critical patent/CN101763436A/en
Priority to HK10110445.8A priority patent/HK1143879A1/en
Application granted granted Critical
Publication of CN101763436B publication Critical patent/CN101763436B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a file packing method and a tool, which relate to the field of computer application. The method comprises the step of establishing a file list comprising path information of files to be packed in advance. The method comprises the following steps: traversing the file list to obtain the total file name length and the total file number of the files to be packed, and outputting a control region including the total number of the files to be packed; calculating and outputting an information region including the data deviation amount and the length of each file to be packed according to the path information, the total file name length and the total file number of the files to be packed, and outputting a data region including data contents of each file to be packed; and carrying out encapsulation according to the ranging sequence of the control region, the information region and the data region. The embodiment of the invention does not care the information such as the format, the content, the file name length and the like of the files to be packed, all files to be packed in the file list are regarded as data streams with equal positions, the problem of limitation on the format, the content and particularly the file name length in the existing file packing technology is thoroughly solved, and the invention can be flexibly used in various application occasions.

Description

A kind of file packing method and instrument
Technical field
The present invention relates to computer application field, particularly a kind of file packing method and instrument.
Background technology
A plurality of files are packaged into a file, applicable to multiple applied environment, such as:
1. the file system interface that lacks, but need a plurality of files of visit
In this case, can be with the file after the packing, promptly single data stream is regarded an easy file system as.
2. resource file
For example, application program needs one group of file, comprises webpage and picture, as interface display.Can be packaged into a file this moment in advance, then data stream is stored in the equipment in advance.Application program by separating packet technology, reads the file content of original multifile in use.This situation is equivalent to initiatively abandon file system interface, can simplify flow process, improves compatible.
3. need utilize a plurality of files of Network Transmission
A plurality of files are packaged into a file, transmit again, help simplifying transfer process, reduce the number of transmissions, improve transfer efficiency.
At present, multiple file packaging technique is arranged, and in implementing process of the present invention, the inventor finds that there are the following problems at least in the prior art, in the file packing process, to form, the content of packaged file, especially filename length etc. has a lot of restrictions, can not be applied in flexibly in the different applied environments, satisfy its multiple different demand, so that limit the popularization and the development of file packaging technique greatly.
Summary of the invention
The invention provides a kind of file packing method and instrument, to solve in the existing file packaging technique restriction to form, content, the especially filename length etc. of packaged file, cause can not flexible Application problem.
The embodiment of the invention provides a kind of file packing method, is pre-created to comprise the listed files for the treatment of the packaging file routing information, and described method comprises:
Travel through described listed files and obtain and treat packaging file title total length and total number of files, output comprises the control zone for the treatment of the packaging file sum;
According to described packaging file routing information, file name total length and the total number of files treated, calculating and output comprise the block of information of respectively treating packaging file length and data offset, and output comprises the data field of respectively treating the packaging file data content;
Put in order according to described control zone, block of information and data field and to encapsulate.
Described output comprises that the control zone for the treatment of the packaging file sum is specially:
It is to be generated by described file packing method packing that the default ident value of output, described ident value are used for sign;
Export first retention, described first retention is used for edition upgrading and/or form expands;
Trade edition this shop;
Obtain current system time, export described current system time;
Export described total number of files;
Export second retention, described second retention is used for edition upgrading and/or form expands;
End of output symbol, described end mark are used to identify described control zone to be finished.
Described according to described packaging file routing information, file name total length and the total number of files treated, calculating and output comprise that the block of information of respectively treating packaging file length and data offset is specially, and the packaging file of respectively treating in the described listed files is carried out following substep successively:
Obtain file name by the current packaging file routing information for the treatment of;
Calculate described file name and obtain file name length, and export described file name length;
Calculate and export the current data offset for the treatment of packaging file;
Open the current packaging file for the treatment of, calculate and export current packaging file length and the proof test value treated;
Export described file name.
The current packaging file data offset for the treatment of of described calculating is specially:
With the described packaging file title total length for the treatment of, and be positioned at the current data content total length addition for the treatment of before the packaging file of respectively treating packaging file in the described listed files, obtain the current side-play amount for the treatment of that packaging file begins from described block of information; Described block of information reference position value is determined by described control zone total length.
The current packaging file data offset for the treatment of of described calculating is specially:
Be positioned at the current packaging file data content total length of respectively treating packaging file before for the treatment of in the described listed files, as the current data offset for the treatment of that packaging file begins from described data field; Described data field reference position value determines that by described control zone and block of information total length described block of information total length is decided by the described packaging file title total length for the treatment of.
Described output comprises that the data field of respectively treating the packaging file data content is specially, and the packaging file of respectively treating in the described listed files is carried out following substep successively:
Open the current packaging file for the treatment of;
Read and export the current data content for the treatment of packaging file.
Describedly open the current packaging file for the treatment of and be specially:
Treat the packaging file path by described listed files directory name and described file path information calculations;
According to opening the current packaging file for the treatment of in the described packaging file path for the treatment of.
The relative path information that described file path information is described relatively listed files directory name, the described packaging file path for the treatment of is for to be made up of described listed files directory name and described file path information;
Described file path information is absolute path information, and the described packaging file path for the treatment of is described file path information.
Described being pre-created comprises that the listed files for the treatment of the packaging file routing information is specially:
In current file packing working directory, create and comprise the listed files for the treatment of the packaging file routing information; Or
Create in other catalogue outside current file packing working directory and comprise the listed files for the treatment of the packaging file routing information.
The embodiment of the invention also provides a kind of file strapping tool, comprising:
The listed files creation module is used to create and comprises the listed files for the treatment of the packaging file routing information;
The control zone output module is used to travel through described listed files and obtains and treat packaging file title total length and total number of files, and output comprises the control zone for the treatment of the packaging file sum;
The block of information output module is used for according to described packaging file routing information, file name total length and the total number of files treated, calculates and export to comprise the block of information of respectively treating packaging file length and data offset;
The data field output module is used to export and comprises the data field of respectively treating the packaging file data content;
Package module, being used for putting in order according to described control zone, block of information and data field encapsulates.
Disclosed file packing method of the embodiment of the invention and instrument, a kind of exclusive packing form is provided, it also is indifferent to the information such as form, content, filename length of packaged file, the packaging file of respectively treating in listed files is all regarded the equal data stream in status as, thereby, thoroughly solved in the existing file packaging technique restriction, can be applied to flexibly in the more applications occasion form, content, the especially filename length etc. of packaged file.
On the other hand, the embodiment of the invention is packaged as control zone, three parts in block of information and data field with file, because when using file system, usually the frequency of utilization of file data is lower than the frequency of utilization of fileinfo, and file data wants huge a lot of with respect to fileinfo, in the packing form that the embodiment of the invention provides, block of information and data field are independently opened, and the block of information placed before the data field, help the operation that fileinfo is read in quickening when using file, further improved whole efficiency.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
The file packing method process flow diagram that Fig. 1 provides for the embodiment of the invention one;
The file packing method process flow diagram that Fig. 2 provides for the embodiment of the invention two;
Fig. 3 is an output control zone method flow diagram in the embodiment of the invention two;
Fig. 4 is an output information district method flow diagram in the embodiment of the invention two;
Fig. 5 is an output data district method flow diagram in the embodiment of the invention two;
The file strapping tool structured flowchart that Fig. 6 provides for the embodiment of the invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
Embodiment one
Referring to Fig. 1, the embodiment of the invention provides a kind of file packing method, comprises the steps:
S101: be pre-created and comprise the listed files listfile that treats the packaging file routing information.
Need to prove, can in current file is packed working directory (being presents strapping tool place work at present catalogue), create and comprise the listed files for the treatment of the packaging file routing information; Perhaps, create in also can other catalogue outside current file is packed working directory and comprise the listed files for the treatment of the packaging file routing information, promptly this packaging technique supports listfile in other catalogue.
S102: traversal listed files listfile obtains and treats packaging file title total length and total number of files, and output comprises the control zone for the treatment of the packaging file sum.
In the practical application, output comprises that the method for the control zone for the treatment of the packaging file sum can be specially:
It is to be generated by described file packing method packing that the default ident value of output, described ident value are used for sign;
Export first retention, described first retention is used for edition upgrading and/or form expands;
Trade edition this shop;
Obtain current system time, export described current system time;
Export described total number of files;
Export second retention, described second retention is used for edition upgrading and/or form expands;
End of output symbol, described end mark are used to identify described control zone to be finished.
S103: according to treating packaging file routing information, file name total length and total number of files, calculating and output comprise the block of information of respectively treating packaging file length and data offset.
In the practical application, according to treating packaging file routing information, file name total length and total number of files, calculating and output comprise that the block of information of respectively treating packaging file length and data offset can be specially, and the packaging file of respectively treating in the listed files is carried out following substep successively:
Obtain file name by the current packaging file routing information for the treatment of;
Calculate described file name and obtain file name length, and export described file name length;
Calculate and export the current data offset for the treatment of packaging file;
Open the current packaging file for the treatment of, calculate and export current packaging file length and the proof test value treated;
Export described file name.
The block of information essential record is respectively treated the packaging file relevant information except that actual file data, such as comprising: and filename length, data offset, file size, crc32 check code, filename, or the like.
Wherein, calculating the current packaging file data offset for the treatment of can be specially:
With the described packaging file title total length for the treatment of, and be positioned at the current data content total length addition for the treatment of before the packaging file of respectively treating packaging file in the described listed files, obtain the current side-play amount for the treatment of that packaging file begins from described block of information; Described block of information reference position value is determined by described control zone total length.
Need to prove that the length of control zone is fixed, and block of information reference position value is determined by the control zone total length, be block of information reference position value relatively the file after the packing be fixed value, the side-play amount that obtains so more helps document alignment when packaging file reads, efficient is higher.
In addition, calculating the current packaging file data offset for the treatment of can also be specially:
Be positioned at the current packaging file data content total length of respectively treating packaging file before for the treatment of in the listed files, as the current data offset for the treatment of that packaging file begins from described data field; Wherein reference position value in data field determines that by described control zone and block of information total length described block of information total length is decided by to treat packaging file title total length.Except treating the packaging file title total length of block of information, the length of other parts of control zone and block of information is all fixed, at this moment the data offset that calculates is a relative data district reference position, and because the block of information is positioned at the front, data field, thereby, when packaging file reads, except considering data offset, also to consider the physical length of block of information during data locking.
S104: output comprises the data field of respectively treating the packaging file data content.
In the practical application, output comprises that the data field of respectively treating the packaging file data content can be specially, and the packaging file of respectively treating in the described listed files is carried out following substep successively:
Open the current packaging file for the treatment of;
Read and export the current data content for the treatment of packaging file.
In the above-mentioned steps, opening the current packaging file for the treatment of can specifically comprise:
Treat the packaging file path by described listed files directory name and described file path information calculations;
According to opening the current packaging file for the treatment of in the described packaging file path for the treatment of.
Wherein, file path information can be the relative path information of relative file list directory name, and corresponding, the described packaging file path for the treatment of is for to be made up of described listed files directory name and described file path information, such as listed files directory name/file path information, etc.
File path information can also be absolute path information, and corresponding, the described packaging file path for the treatment of is described file path information.
S105: putting in order according to control zone, block of information and data field encapsulates.
Need to prove, the output of control zone, block of information and data field order can be output control zone, output information district more earlier, last output data district also can export by other in the practical application in proper order, its output is not limited in proper order in the embodiment of the invention.
As seen, the embodiment of the invention provides a kind of exclusive packing form, it also is indifferent to the information such as form, content, filename length of packaged file, the packaging file of respectively treating in listed files is all regarded the equal data stream in status as, thereby, thoroughly solved in the existing file packaging technique restriction, can be applied to flexibly in the more applications occasion form, content, the especially filename length etc. of packaged file.
On the other hand, the embodiment of the invention is packaged as control zone, three parts in block of information and data field with file, because when using file system, usually the frequency of utilization of file data is lower than the frequency of utilization of fileinfo, and file data wants huge a lot of with respect to fileinfo, in the packing form that the embodiment of the invention provides, block of information and data field are independently opened, and the block of information placed before the data field, help the operation that fileinfo is read in quickening when using file, further improved whole efficiency.
Embodiment two
Referring to Fig. 2, the embodiment of the invention provides a kind of method example that 6 files are packed, and specifically may further comprise the steps:
S201: create a listed files listfile, list the file that needs packing line by line.
Listed files listfile example is as follows:
??file_a.html??file_b.html??dir_a/file_c.txt??imagea.gif??image_b.jpg??image_c.png
This packaging technique also is indifferent to the information such as length of form, content and the file name of packaged file, and All Files is all regarded the equal data stream in status as.
This packaging technique is supported in treats among the listfile that the packaging file routing information can adopt relative path or absolute path.
If relative path, then relative is listfile place catalogue.
This packaging technique can support listfile and presents strapping tool work at present catalogue not in the situation of same catalogue, and promptly listfile can be in other catalogues.
S202: read the current command line parameter listfile (listed files title), and call the file output subfunction outfile of establishment in advance.
S203: judging whether parameter is correct, is execution in step S204 then, otherwise finishes.
S204:, open listing file listfile with read-only mode with the fopen function that the parameter l istfile system of being sent to carries.
Wherein, the fopen function can be the api function that linux system or other system carry, the function of this api function is to obtain the directory name of this document according to the parameter (normally file name) that receives, file packing method in the embodiment of the invention can directly call this API, open listing file listfile, specifically comprise following substep:
The parameter l istfile system of being sent to is carried the fopen function, obtain the directory name path of listing file listfile;
Open listing file listfile with read-only mode.
It will be understood by those skilled in the art that the fopen function carries api function as system, it obtains the listfile directory name and repeats no more with the specific implementation process that read-only mode is opened listfile herein.
S205: judging whether to open success, is execution in step S206 then, otherwise finishes.
S206: traversal listed files listfile, obtain and treat packaging file sum fn, and calculation document title total length total_name_len.
Need to prove that file name total length total_name_len is used for determining side-play amount offset in down-stream.
S207: carry out control zone output subprocess.
Setting in advance the control zone is regular length, and such as 32 bytes, each byte content is referring to table 1.
Table 1
??0 ??1 ??2 ??3 ??4 ??5 ??6 ??7 ??8 ??9 ??10 ??11 ??12 ??13 ??14 ??15
??M ??M ??M ??R ??R ??R ??R ??R ??R ??R ??V ??Y ??Y ??Y ??Y ??M
??16 ??17 ??18 ??19 ??20 ??21 ??22 ??23 ??24 ??25 ??26 ??27 ??28 ??29 ??30 ??31
??M ??D ??D ??H ??H ??M ??M ??S ??S ??N ??N ??N ??N ??R ??M ??M
Concrete implication sees also table 2.
Table 2
Skew Value Explanation
0~2 0x181C1D Fixed value is used to judge whether file is the file that the present technique packing generates.
3~9 0x00 Retention, edition upgrading after treating, usefulness when form expands.
Skew Value Explanation
10 0x02 Version number, current version number is 2.
11~24 Time The rise time of packaging file.Deposit by a date hour every minute and second YYYYMMDDHHMMSS form.
25~28 Total number of files Total number of files fn.Deposit by the network bytes preface.
29 0x00 Retention, edition upgrading after treating, usefulness when form expands.
30~31 0x0D0A Fixed value, r n, show that the control zone finishes.
Referring to Fig. 3, the output substep of control zone comprises:
S301: output 0x181C1D.
S302: export 7 0x00.
S303: output 0x02.
S304: obtain current system time, press the output of YYYYMMDDHHMMSS (little Hour Minute Second of date) form.
S305: press network bytes preface output file sum fn.
S306: output 0x00.
S307: output 0x0D0A.
In the realization, the step of output control zone is specific as follows with the description of similar C language:
struct?head{
Unsigned char b_magicl[3]; / * magicl: fixed value, 0x181C1D*/
Unsigned char b_reservel[7]; / * reservel: retention, be full 0x00*/
Unsigned char b_version[1]; / * version: version number, currency be 0x02*/
Unsigned char b_time[12]; / * time: press YYYYMMDDHHMMS S lattice
The packing time * that formula stores/
Unsigned char b_fn[2]; / * fn: the total number of files * that deposits by the network bytes preface/
Unsigned char b_reserve2[1]; / * reserve2: retention, be full 0x00*/
Unsigned char b_magic2[2]; / * magic2: fixed value, 0x0D0A, promptly r n*/
}
S208: carry out block of information output subprocess.
Block of information essential record each file-related information except that actual file data.Comprise: filename length, data-bias position, file size, crc32 check code, filename.
Specified format is pressed in the block of information, and circulation repeats fn time, and fn is the total number of files of control zone definition.
Referring to Fig. 4, the output substep of block of information comprises:
S401: file sequence number variable fid is set equals 0.
S402: the total size variable total_file_size of file is set equals 0.
S403: whether judging fid less than fn, is execution in step S404 then, otherwise finishes.
S404: read the individual packaging file title name that treats of fid among the listfile.
S405: the length l en of calculation document title name and output.
S406: ask by listing file listfile place directory name and file path information and to treat path filename of living in before the packaging file packing.
If file path information is relative path, then directly use path/ file path information.
If file path information is absolute path, then directly use file path information.
S407: calculation document data offset offset and output.
Wherein, calculating the current packaging file data offset for the treatment of can be specially:
With the described packaging file title total length for the treatment of, and be positioned at the current data content total length addition for the treatment of before the packaging file of respectively treating packaging file in the described listed files, obtain the current side-play amount for the treatment of that packaging file begins from described block of information; Described block of information reference position value is determined by described control zone total length.
Need to prove that the length of control zone is fixed, and block of information reference position value is determined by the control zone total length, be block of information reference position value relatively the file after the packing be fixed value, the side-play amount that obtains so more helps document alignment when packaging file reads, efficient is higher.
In addition, calculating the current packaging file data offset for the treatment of can also be specially:
Be positioned at the current packaging file data content total length of respectively treating packaging file before for the treatment of in the listed files, as the current data offset for the treatment of that packaging file begins from described data field; Wherein reference position value in data field determines that by described control zone and block of information total length described block of information total length is decided by to treat packaging file title total length.Except treating the packaging file title total length of block of information, the length of other parts of control zone and block of information is all fixed, at this moment the data offset that calculates is a relative data district reference position, and because the block of information is positioned at the front, data field, thereby, when packaging file reads, except considering data offset, also to consider the physical length of block of information during data locking.
S408: open the current packaging file for the treatment of.
S409: calculation document size size and output.
S410: calculation document data crc32 proof test value, and output.
S411: export the current packaging file title name that treats.
S412: close the current packaging file for the treatment of.
S413: file sequence number variable fid is added 1 handle.
S414:,, continue execution in step S403 with the value of result as the total size variable total_file_size of current file with total size variable total_file_size of file and size addition.
In the realization, with being described below of similar C language:
for(i=0;i<fn;i++){
struct?rect{
Unsigned char b_len[2]; The length * of/* len:name/
Unsigned char b_offset[4]; / * offset: the position of file data in buffer, from information
The side-play amount * of district's beginning/
Unsigned char b_size[4]; / * size: the file data size * that deposits by the network bytes preface/
Unsigned char b_crc32[4]; / * crc32: file data crc32 check code */
Char name[len]; / * name: filename, len be name length */
}
}
S209: carry out data field output subprocess.
The file data of data recordng reality, i.e. size field in the block of information.
Specified format is pressed in the data field, and circulation repeats fn time, and fn is the total number of files of control zone definition.
Referring to Fig. 5, the output substep of data field comprises:
S501: file sequence number variable fid is set equals 0.
S502: whether judging fid less than fn, is execution in step S503 then, otherwise finishes.
S503: read fid file path information for the treatment of packaging file among the listfile.
S504: ask by listing file listfile place directory name and file path information and to treat path filename of living in before the packaging file packing.
S505: open the current packaging file for the treatment of.
S506: read the current data content data that treats packaging file.
S507: export the current data content data that treats packaging file.
S508: close the current packaging file for the treatment of.
S509: file sequence number variable fid is added 1 handle, continue execution in step S502.
In the realization, with being described below of similar C language:
for(i=0;i<fn;i++){
struct?data{
Unsigned char b_data[size]; / * data: the file real data, size is that the block of information is right
The file size field * that answers/
}
}
S210: close file tabulation listfile.
S211: close subfunction outfile.
S212: finish.
Embodiment three
Referring to Fig. 6, the embodiment of the invention also provides a kind of file strapping tool, comprising:
Listed files creation module 601 is used to create and comprises the listed files for the treatment of the packaging file routing information;
Control zone output module 602 is used to travel through described listed files and obtains and treat packaging file title total length and total number of files, and output comprises the control zone for the treatment of the packaging file sum;
Block of information output module 603 is used for according to described packaging file routing information, file name total length and the total number of files treated, calculates and export to comprise the block of information of respectively treating packaging file length and data offset;
Data field output module 604 is used to export and comprises the data field of respectively treating the packaging file data content;
Package module 605, being used for putting in order according to described control zone, block of information and data field encapsulates.
Need to prove that the embodiment of the invention provides the file strapping tool can realize Fig. 1-described file packing method of Fig. 5 any embodiment, its concrete technical characterictic can repeat no more referring to the technical characterictic in Fig. 1-Fig. 5 any embodiment herein.
The embodiment of the invention provides a kind of exclusive packing form, it also is indifferent to the information such as form, content, filename length of packaged file, the packaging file of respectively treating in listed files is all regarded the equal data stream in status as, thereby, form, content have thoroughly been solved in the existing file packaging technique to packaged file, especially the restriction of filename length etc. can be applied in the more applications occasion flexibly.
On the other hand, the embodiment of the invention is packaged as control zone, three parts in block of information and data field with file, because when using file system, usually the frequency of utilization of file data is lower than the frequency of utilization of fileinfo, and file data wants huge a lot of with respect to fileinfo, in the packing form that the embodiment of the invention provides, block of information and data field are independently opened, and the block of information placed before the data field, help the operation that fileinfo is read in quickening when using file, further improved whole efficiency.
Need to prove, in this article, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby make and comprise that process, method, article or the equipment of a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or also be included as this process, method, article or equipment intrinsic key element.Do not having under the situation of more restrictions, the key element that limits by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
One of ordinary skill in the art will appreciate that, realize that all or part of step in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in the computer read/write memory medium, this program comprises that some instructions are in order to carry out the described method of each embodiment of the present invention when carrying out.Storage medium described here, as: ROM/RAM, magnetic disc, CD etc.
The present invention is not limited to above-mentioned embodiment, and the identical or akin product of other patents any and of the present invention that anyone draws under the enlightenment of patent of the present invention all drops within the protection domain of patent of the present invention.

Claims (10)

1. a file packing method is characterized in that, is pre-created to comprise the listed files for the treatment of the packaging file routing information, and described method comprises:
Travel through described listed files and obtain and treat packaging file title total length and total number of files, output comprises the control zone for the treatment of the packaging file sum;
According to described packaging file routing information, file name total length and the total number of files treated, calculating and output comprise the block of information of respectively treating packaging file length and data offset, and output comprises the data field of respectively treating the packaging file data content;
Put in order according to described control zone, block of information and data field and to encapsulate.
2. method according to claim 1 is characterized in that, described output comprises that the control zone for the treatment of the packaging file sum is specially:
It is to be generated by described file packing method packing that the default ident value of output, described ident value are used for sign;
Export first retention, described first retention is used for edition upgrading and/or form expands;
Trade edition this shop;
Obtain current system time, export described current system time;
Export described total number of files;
Export second retention, described second retention is used for edition upgrading and/or form expands;
End of output symbol, described end mark are used to identify described control zone to be finished.
3. method according to claim 1, it is characterized in that, described according to described packaging file routing information, file name total length and the total number of files treated, calculating and output comprise that the block of information of respectively treating packaging file length and data offset is specially, and the packaging file of respectively treating in the described listed files is carried out following substep successively:
Obtain file name by the current packaging file routing information for the treatment of;
Calculate described file name and obtain file name length, and export described file name length;
Calculate and export the current data offset for the treatment of packaging file;
Open the current packaging file for the treatment of, calculate and export current packaging file length and the proof test value treated;
Export described file name.
4. method according to claim 3 is characterized in that, the current packaging file data offset for the treatment of of described calculating is specially:
With the described packaging file title total length for the treatment of, and be positioned at the current data content total length addition for the treatment of before the packaging file of respectively treating packaging file in the described listed files, obtain the current side-play amount for the treatment of that packaging file begins from described block of information; Described block of information reference position value is determined by described control zone total length.
5. method according to claim 3 is characterized in that, the current packaging file data offset for the treatment of of described calculating is specially:
Be positioned at the current packaging file data content total length of respectively treating packaging file before for the treatment of in the described listed files, as the current data offset for the treatment of that packaging file begins from described data field; Described data field reference position value determines that by described control zone and block of information total length described block of information total length is decided by the described packaging file title total length for the treatment of.
6. method according to claim 1 is characterized in that, described output comprises that the data field of respectively treating the packaging file data content is specially, and the packaging file of respectively treating in the described listed files is carried out following substep successively:
Open the current packaging file for the treatment of;
Read and export the current data content for the treatment of packaging file.
7. according to claim 3 or 6 described methods, it is characterized in that, describedly open the current packaging file for the treatment of and be specially:
Treat the packaging file path by described listed files directory name and described file path information calculations;
According to opening the current packaging file for the treatment of in the described packaging file path for the treatment of.
8. method according to claim 7 is characterized in that, the relative path information that described file path information is described relatively listed files directory name, and the described packaging file path for the treatment of is for to be made up of described listed files directory name and described file path information;
Described file path information is absolute path information, and the described packaging file path for the treatment of is described file path information.
9. method according to claim 1 is characterized in that, described being pre-created comprises that the listed files for the treatment of the packaging file routing information is specially:
In current file packing working directory, create and comprise the listed files for the treatment of the packaging file routing information; Or
Create in other catalogue outside current file packing working directory and comprise the listed files for the treatment of the packaging file routing information.
10. a file strapping tool is characterized in that, comprising:
The listed files creation module is used to create and comprises the listed files for the treatment of the packaging file routing information;
The control zone output module is used to travel through described listed files and obtains and treat packaging file title total length and total number of files, and output comprises the control zone for the treatment of the packaging file sum;
The block of information output module is used for according to described packaging file routing information, file name total length and the total number of files treated, calculates and export to comprise the block of information of respectively treating packaging file length and data offset;
The data field output module is used to export and comprises the data field of respectively treating the packaging file data content;
Package module, being used for putting in order according to described control zone, block of information and data field encapsulates.
CN2010101123335A 2010-02-08 2010-02-08 File packing method and tool Active CN101763436B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN2010101123335A CN101763436B (en) 2010-02-08 2010-02-08 File packing method and tool
HK10110445.8A HK1143879A1 (en) 2010-02-08 2010-11-10 Method and device for packing files

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010101123335A CN101763436B (en) 2010-02-08 2010-02-08 File packing method and tool

Publications (2)

Publication Number Publication Date
CN101763436A true CN101763436A (en) 2010-06-30
CN101763436B CN101763436B (en) 2012-06-20

Family

ID=42494600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010101123335A Active CN101763436B (en) 2010-02-08 2010-02-08 File packing method and tool

Country Status (2)

Country Link
CN (1) CN101763436B (en)
HK (1) HK1143879A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508880A (en) * 2011-10-18 2012-06-20 广东威创视讯科技股份有限公司 Method for joining files and method for splitting files
CN103136293A (en) * 2011-12-02 2013-06-05 福建星网视易信息系统有限公司 Form design and read method of picture resource bundles
CN103294784A (en) * 2013-05-17 2013-09-11 珠海金山网络游戏科技有限公司 File packing method and system based on Hook technology
CN107402788A (en) * 2017-07-25 2017-11-28 网易(杭州)网络有限公司 Resource packing management method and device
CN107589948A (en) * 2017-07-28 2018-01-16 北京北信源软件股份有限公司 Item file dispositions method and system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508880A (en) * 2011-10-18 2012-06-20 广东威创视讯科技股份有限公司 Method for joining files and method for splitting files
CN102508880B (en) * 2011-10-18 2014-07-02 广东威创视讯科技股份有限公司 Method for joining files and method for splitting files
CN103136293A (en) * 2011-12-02 2013-06-05 福建星网视易信息系统有限公司 Form design and read method of picture resource bundles
CN103136293B (en) * 2011-12-02 2016-01-13 福建星网视易信息系统有限公司 The format design of picture resource bag and read method
CN103294784A (en) * 2013-05-17 2013-09-11 珠海金山网络游戏科技有限公司 File packing method and system based on Hook technology
CN103294784B (en) * 2013-05-17 2016-08-24 珠海金山网络游戏科技有限公司 A kind of file packing method based on Hook technology and system
CN107402788A (en) * 2017-07-25 2017-11-28 网易(杭州)网络有限公司 Resource packing management method and device
CN107402788B (en) * 2017-07-25 2020-09-25 网易(杭州)网络有限公司 Resource packaging management method and device
CN107589948A (en) * 2017-07-28 2018-01-16 北京北信源软件股份有限公司 Item file dispositions method and system

Also Published As

Publication number Publication date
HK1143879A1 (en) 2011-01-14
CN101763436B (en) 2012-06-20

Similar Documents

Publication Publication Date Title
TWI730654B (en) Method and device for deploying and executing smart contract
CN101763436B (en) File packing method and tool
CN104503745B (en) A kind of method and apparatus generated using channel packet
TW201445355A (en) Protecting data
Ke et al. On traffic-aware partition and aggregation in mapreduce for big data applications
CN106407111B (en) Terminal test device, terminal test equipment and variable maintaining method
CN103176833A (en) Data transmission method, data receiving method and system based on virtual machine
CN106656920B (en) Processing method, device, storage medium and the processor of HTTP service
CN105426348B (en) A kind of generation method, the device and system of expandable mark language XML file
WO2023109270A1 (en) Smart contract deployment method and apparatus, smart contract transaction method and apparatus, and electronic device
CN101395920A (en) Device and method for generating a media package
CN105468412A (en) Dynamic packaging method and dynamic packaging device
Kumar et al. A cancellation theorem for projective modules over finitely generated rings
CN101739391A (en) Method for generating electronic book with binary file format and electronic book generated by same
CN102750287A (en) Method for including index information and download authentication server
JP5528644B2 (en) Method, computer system, and computer program (product) for creating and modifying data packets for storage reduction (memory-saving packet modification)
CN106529328A (en) Secure storing method and device for picture files
CN104504044B (en) The intelligent method for packing and system of a kind of e-file
Olfati-Saber et al. Flocking with obstacle avoidance
CN110059075A (en) A kind of method, apparatus of database migration, equipment and computer-readable medium
CN109697069A (en) A kind of packaging method and terminal of H5 application
CN110888883A (en) Data storage method, device, system and storage medium
CN110008281A (en) A kind of processing method and processing device based on Redis database visualization data
Zhang Comprehensive preimage security evaluations on Rijndael-based hashing
CN111130788A (en) Data processing method and system, data reading method and iSCSI server

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1143879

Country of ref document: HK

C14 Grant of patent or utility model
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: GR

Ref document number: 1143879

Country of ref document: HK