Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of method of applying network hard disk, can save the memory space of network hard disc, reduces interactive data quantity between the client and server, conserve network resources.
In order to achieve the above object, the technical scheme of the present invention's proposition is:
A kind of method of applying network hard disk, when needs with file storage during at network hard disc, this method is:
The network hard disc client is earlier compressed described file, and in the process of compression, by write file instruction compressed portion be transferred to the network hard disc server and preserve.
In the such scheme, create the compression catalogue at the network hard disc server in advance, described compression catalogue is used to preserve the file through overcompression, and described network hard disc server is kept at file in the compression catalogue.
In the such scheme, described network hard disc server also comprises non-compression catalogue, and described non-compression catalogue is used to preserve the file without overcompression, and before the then described network hard disc client compressed file, this method further comprises:
A1, network hard disc client are obtained the routing information by user's appointment, and described routing information comprises the catalogue that will preserve file;
A2, network hard disc client judge according to described routing information whether the catalogue that will preserve file is the compression catalogue again, if the compression catalogue then continues to carry out; If be non-compression catalogue, then directly described file is transferred to the network hard disc server by writing file instruction, be kept in the non-compression catalogue by the network hard disc server.
In the such scheme, further comprise after the described step a2:
A3, network hard disc server return success the message of preservation to the network hard disc client.
According to claim 3 or 4 described methods, it is characterized in that 5, during file in reading the network hard disc server, this method further comprises:
B1, network hard disc client are obtained the routing information by user's appointment, and described routing information comprises the catalogue at the file place that will read, and the file instruction that reads that will carry routing information again sends to the network hard disc server;
B2, network hard disc server obtain file according to described routing information, and return to the network hard disc client;
B3, network hard disc client judge according to routing information whether file place catalogue is the compression catalogue, if the compression catalogue is then carried out decompress(ion) with described file; If be non-compression catalogue, then do not deal with.
In the such scheme, after the described step b3, this method further comprises:
B4, network hard disc server return to the network hard disc client with the message that successfully reads.
In the such scheme, when needs when the network hard disc server creaties directory, this method further comprises:
The instruction that creaties directory that the network hard disc client will carry directory attribute is transferred to the network hard disc server, and described directory attribute is used to identify catalogue and is compression catalogue or non-compression catalogue; The network hard disc server is created compression catalogue or non-compression catalogue according to directory attribute.
In the such scheme, after the network hard disc server creatied directory, this method further comprised:
The network hard disc server returns to the network hard disc client with the message that successfully creaties directory.
In the such scheme, when the file in the needs deletion network hard disc, this method further comprises:
The deleted file instruction that the network hard disc client will carry routing information sends to the network hard disc server, and the network hard disc server obtains and deleted file according to routing information.
In the such scheme, after network hard disc server deleted file, this method further comprises:
The network hard disc server returns to the network hard disc client with successful message of deleting.
In sum, the present invention proposes a kind of method of applying network hard disk, and the network hard disc client is earlier compressed described file, and in the process of compression, by write file instruction compressed portion be transferred to the network hard disc server and preserve.Correspondingly, when reading file, the network hard disc server is given the network hard disc client with file transfer earlier, by network hard disc client decompress(ion).Like this, be file because the network hard disc server preserves through overcompression, can improve the capacity of network hard disc server significantly, conserve storage.In addition, because transmission can conserve network resources through the file of overcompression between network hard disc client and the network hard disc server, improve efficiency of transmission.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, the present invention is described in further detail below in conjunction with the accompanying drawings and the specific embodiments.
Basic thought of the present invention is: earlier file is compressed, be kept in the network hard disc server again, improve the capacity of network hard disc server with this, and reduce interactive data quantity between network hard disc server and the network hard disc client.
Fig. 1 is the present invention program's a flow chart.As shown in Figure 1, file storage during at network hard disc, be the present invention includes following steps when needs:
Step 101: the network hard disc client is compressed described file.
Step 102: in the process of compression, the network hard disc client is by writing file instruction, and compressed portion is transferred to the preservation of network hard disc server.
In order to distinguish file better through overcompression, still without overcompression, the network hard disc server can be pre-created the compression catalogue, and compression catalogue described here is specifically designed to the file of preservation through overcompression.
For the present existing network hard disc using method of compatibility, can in the network hard disc server, set up non-compression catalogue, be specifically designed to the file of preservation without overcompression.
That is to say that if existing compression catalogue in the network hard disc server has non-compression catalogue again, the routing information of preserving file is promptly specified in the position that just needs user's specified file to preserve, described routing information comprises the catalogue that will preserve file.
At this moment, before the described step 101, this method need further comprise:
A1, network hard disc client are obtained the routing information by user's appointment, and described routing information comprises the catalogue that will preserve file;
A2, network hard disc client judge according to described routing information whether the catalogue that will preserve file is the compression catalogue again, if the compression catalogue then continues to carry out; If be non-compression catalogue, then directly described file is transferred to the network hard disc server by writing file instruction, be kept in the non-compression catalogue by the network hard disc server.
The present invention program be described in detail below with embodiment in order better to illustrate.
In the present embodiment, with before file storage is in server, compression catalogue and non-compression catalogue in the network hard disc server, have been created in the network hard disc client.
Fig. 2 has shown the flow chart that present embodiment network hard disc client creaties directory.As shown in Figure 2, the method that creaties directory may further comprise the steps:
Step 201: the instruction that creaties directory that the network hard disc client will carry directory attribute is transferred to the network hard disc server, and described directory attribute is used to identify catalogue and is compression catalogue or non-compression catalogue.
Directory attribute can represent with a bit, such as: 1 expression compression catalogue, the non-compression catalogue of 0 expression.Certainly, can also represent directory attribute, as long as the network hard disc server can be discerned with other modes.
The described instruction that creaties directory also needs to comprise routing information and directory name usually, and the network hard disc server will create directory under the path of appointment according to the instruction that creaties directory, and the directory name of creating be set to instruct in the directory name of appointment.Createing directory according to routing information and directory name as for how belongs to prior art, repeats no more herein.
Step 202: the network hard disc server is differentiated directory attribute, if compression catalogue sign, then execution in step 203; If be non-compression catalogue sign, then execution in step 204.
Step 203: the network hard disc server is created the compression catalogue, and withdraws from this flow process.
Step 204: the network hard disc server is created non-compression catalogue, and withdraws from this flow process.
The method that creaties directory in step 203 described here and the step 204 is not essentially different, and its difference only is that needing the new catalogue of creating of record is that the compression catalogue also is non-compression catalogue.Certainly, for convenience the user distinguishes, can be with different icons or color Display directory.
No matter be that establishment compression catalogue also is non-compression catalogue, after establishment was finished, the network hard disc server can also return success the message that creaties directory to the network hard disc client, and the network hard disc client is shown to the user with the information that successfully creaties directory again
Fig. 3 is that the network hard disc client is kept at flow chart in the server with file in the present embodiment.As shown in Figure 3, the method for preservation file may further comprise the steps:
Step 301: the network hard disc client is obtained the routing information by user's appointment, and described routing information comprises the catalogue that will preserve file.
In the present embodiment,, file need be kept under that catalogue, can determine voluntarily by the user, promptly by user's specified path information owing to have compression catalogue and non-compression catalogue in the network hard disc server.The method of user's specified path information can have a lot, such as directly specifying with order line, perhaps in the graphic interface of network hard disc client display server bibliographic structure, click the file that needs to preserve file, just can determine routing information from root to the file of clicking so.
Step 302: the network hard disc client judges according to described routing information whether the catalogue that will preserve file is the compression catalogue, if the compression catalogue, then execution in step 303 again; Otherwise, execution in step 305.
Because the network hard disc client can be preserved bibliographic structure in the network hard disc server in advance, also preserve the directory attribute of each catalogue naturally, so, when determining the catalogue that needs are preserved according to routing information, just can be easy to determine the directory attribute of this catalogue, promptly compress catalogue or non-compression catalogue.
Step 303: the file that the network hard disc client will need to preserve compresses, in the process of compression, by write file instruction will be compressed portion be transferred to the network hard disc server.
The present invention adopts the transmission manner while compressing, such as: the file that will need to compress is divided into n part, earlier first part is compressed, to after having compressed immediately, compressed portion is transferred to the network hard disc server, simultaneously second part is compressed, the rest may be inferred, up to complete file of compression.
In the practical application, the network hard disc client can adopt a lot of compression methods that file is compressed, such as ZIP compression method etc.
In addition, this step said write file instruction also needs to comprise information such as routing information, filename usually.
Step 304: the network hard disc server is kept at file in the compression catalogue, and described compression catalogue is the catalogue described in the routing information.
In order to narrate conveniently, the catalogue in the present embodiment all is the catalogue under the network hard disc server root directory, and in the practical application, the user can also specify some subdirectories for preserving the catalogue of file, and its method is same as the prior art, repeats no more herein.
But it should be noted that if comprise multistage catalogue in the routing information if highest catalogue is the compression catalogue, then all subdirectories all should be the compression catalogue; If highest catalogue is non-compression catalogue, then all subdirectories all should be non-compression catalogue.And the network hard disc server should be kept at file in the catalogue of minimum one-level.
Step 305: the network hard disc client is directly given the network hard disc server with file transfer by writing file instruction.
Step 306: the network hard disc server is kept at file in the non-compression catalogue, and described non-compression catalogue is the catalogue described in the routing information.
Described step 305 and step 306 are to need not File Compress, the method can with existing network hard disc technical compatibility.
In addition, preserve after the file, the network hard disc server can also return success the message of preservation to the network hard disc client, and the network hard disc client can be shown to the user with the information that success is preserved.
Fig. 4 is the flow chart that the network hard disc client reads file in the server in the present embodiment.As shown in Figure 4, the method that reads file may further comprise the steps:
Step 401: the network hard disc client is obtained the routing information by user's appointment, and described routing information comprises the catalogue at the file place that will read.
Identical during with the preservation file, to read the file under that catalogue here, also can determine voluntarily, promptly by user's specified path information by the user.The method of user's specified path information also can have employing directly to specify with order line, perhaps in the graphic interface of network hard disc client display server bibliographic structure, the file that click need be read just can be determined routing information from root to the file of clicking so.
Step 402: the file instruction that reads that the network hard disc client will carry routing information sends to the network hard disc server.
Step 403: the network hard disc server obtains file according to described routing information, and returns to the network hard disc client.
Step 404: the network hard disc client judges according to routing information whether file place catalogue is the compression catalogue, if the compression catalogue, then execution in step 405; If be non-compression catalogue, then do not deal with.
Step 405: the network hard disc client will be carried out decompress(ion) from the file that the network hard disc server returns.
This step, network hard disc client are in the process that receives file, and the file edge joint that receives is received the limit decompress(ion).Such as: file is divided into n part, earlier first part of receiving is carried out decompress(ion), receive second part simultaneously, carry out decompress(ion) to second part again, and the rest may be inferred.
Afterwards, the network hard disc server can also return to the message that successfully reads the network hard disc client, and the network hard disc client is shown to the user with the information that successfully reads.
Fig. 5 is the flow chart that the network hard disc client is deleted file in the network hard disc in the present embodiment.As shown in Figure 5, the method for deleted file may further comprise the steps:
Step 501: the deleted file instruction that the network hard disc client will carry routing information sends to the network hard disc server.
Identical when preserving file or reading file, to delete the file under which catalogue here, also can determine voluntarily by the user, promptly, repeat no more by user's specified path information herein.
Step 502: the network hard disc server obtains and deleted file according to routing information.
Afterwards, the network hard disc server can return to the network hard disc client with the message that success is deleted, and the network hard disc client is shown to the user again.
In fact, catalogue also is non-compression catalogue no matter the catalogue at file place is compression, and the method for deleted file is same as the prior art, i.e. the present invention can compatible prior art.
Use the present embodiment scheme, can create compression catalogue and non-compression catalogue in the network hard disc server, if the user selects file is saved in when compressing in the catalogue, the network hard disc client need be transmitted file through overcompression again; Correspondingly, if the file that the user selects to read is the file in the compression catalogue, then the network hard disc server is transferred to the network hard disc client with this document earlier, by network hard disc client decompress(ion).Like this, be file because the network hard disc server preserves in the catalogue in compression through overcompression, can improve the capacity of network hard disc server significantly, conserve storage.Simultaneously, because the flanging transmission manner is separated on transmission while compress and limit that the present invention adopts, can save compressed and total time of transmission, the efficient that improves compression and transmit.In addition, because transmission can conserve network resources through the file of overcompression between network hard disc client and the network hard disc server, improve efficiency of transmission.
In sum, more than be preferred embodiment of the present invention only, be not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.