Summary of the invention
Based on this, be necessary the technical problem of the operational inconvenience that file too large for file and that cause sends, a kind of method that can improve the Transmit message of the convenience in file transmit operation is provided.
In addition, be also necessary to provide a kind of terminal that can improve the convenience in file transmit operation.
A method for Transmit message, described method comprises:
Receive the instruction of transmit leg Transmit message;
According to described instruction, obtain the memory capacity of described file;
Whether the memory capacity that judges described file exceeds preset capacity threshold;
When judgment result is that while being, described file is compressed to processing;
Send the file of processing through described compression.
In an embodiment, described method also comprises step therein:
To recipient, send described file is compressed to the request of processing;
Receive described recipient according to the confirmation of described request feedback;
Describedly when judgment result is that while being, described file is compressed to the step of processing, is specially:
When judgment result is that when being and receiving described confirmation, described file is compressed to processing.
Therein in an embodiment, describedly when judgment result is that while being, described file is compressed to the step of processing, comprising:
When judgment result is that while being, according to the attribute information of described file, determine the compression algorithm that has preset corresponding relation with described attribute information;
According to definite compression algorithm, described file is compressed to processing.
In an embodiment, described attribute information comprises the first attribute information or the second attribute information therein;
Described method also comprises step:
There is the first corresponding relation in preset the first attribute information and Lossy Compression Algorithm;
There is the second corresponding relation in preset the second attribute information and lossless compression algorithm;
Describedly when judgment result is that while being, described file is compressed to the step of processing, is specially:
When judgment result is that, be and when described file has described the first attribute information, according to described the first corresponding relation, use Lossy Compression Algorithm to compress processing to described file;
Or
When judgment result is that, be and when described file has described the second attribute information, according to described the second corresponding relation, use lossless compression algorithm to compress processing to described file.
Therein in an embodiment, describedly when judgment result is that while being, described file is compressed to the step of processing, comprising:
When judgment result is that while being, calculate the memory capacity of described file after overcompression is processed;
Determine when result of calculation is more than or equal to capacity threshold, according to described capacity threshold, to described file, divide rolling compression to process.
A terminal, comprising:
Command reception module, for receiving the instruction of transmit leg Transmit message;
Memory capacity acquisition module, for the instruction receiving according to described command reception module, obtains the memory capacity of described file;
Judge module, for judging whether the memory capacity of the file that described memory capacity acquisition module obtains exceeds preset capacity threshold;
Compression module, for when judgment result is that of judge module is, compresses processing to described file;
Sending module, for sending the file of processing through described compression module compression.
In an embodiment, described terminal also comprises therein:
Request initiation module, for sending described file compressed to the request of processing to recipient;
Confirm receiver module, for receiving described recipient according to the confirmation of the request feedback of described request initiation module transmission;
Described compression module is specifically for when judgment result is that of judge module being and when described confirmation receiver module receives the confirmation information, described file being compressed to processing.
In an embodiment, described compression module comprises therein:
Algorithm determining unit, for when judgment result is that while being, determines the compression algorithm that has preset corresponding relation with described attribute information according to the attribute information of described file;
Compression processing unit, for compressing processing according to the definite compression algorithm of described algorithm determining unit to described file.
In an embodiment, described attribute information comprises the first attribute information or the second attribute information therein;
Described terminal also comprises:
, there is the first corresponding relation for preset the first attribute information and Lossy Compression Algorithm in preset module, preset the second attribute information and lossless compression algorithm exist the second corresponding relation;
Described compression processing unit is specifically for being and when described file has described the first attribute information, using Lossy Compression Algorithm to compress processing to described file according to described the first corresponding relation when judgment result is that;
Or
Described compression processing unit is specifically for being and when described file has described the second attribute information, using lossless compression algorithm to compress processing to described file according to described the second corresponding relation when judgment result is that.
In an embodiment, described compression module comprises therein:
Calculation of capacity unit, for when judgment result is that while being, calculates the memory capacity of described file after overcompression is processed;
Bundling compression unit, when determining that the result of calculation of described calculation of capacity unit is more than or equal to capacity threshold, divide rolling compression processing according to described capacity threshold to described file.
The method of above-mentioned Transmit message and terminal, receive the instruction of transmit leg Transmit message, according to this instruction, obtain the memory capacity of file, to judge whether the volume of file has exceeded preset capacity threshold, when judgment result is that while being, can compress processing to file, the file that concurrent warp let-off overcompression is processed, therefore, in the situation that the memory capacity of file is excessive, will need transmit leg to carry out extra operation and directly file is compressed, improved the operational convenience that file sends.
Embodiment
As shown in Figure 1, in one embodiment, a kind of method of Transmit message, comprising:
S110, receives the instruction of transmit leg Transmit message.
In the present embodiment, side to be sent, after file transmit operation is triggered at the transmission interface of file, will generate the instruction of transmit leg Transmit message.Wherein, the transmission interface of this document can be the client end interface of JICQ, can be also the client end interface of the social instrument of virtual network, can also be the interface of various webpage clients, in addition can be also that other is for realizing the software interface of file transfer.
S130, according to this instruction, obtains the memory capacity of file.
In the present embodiment, according to the instruction of transmit leg Transmit message, obtain the memory capacity of file, wherein, the file that transmit leg is current sent can be a file, can be also a plurality of files.
S150, judges whether the memory capacity of file exceeds default capacity threshold, when judgment result is that while being, enters S170, when the determination result is NO, enters S190.
In the present embodiment, whether while being used for the memory capacity of file to transfinite, the capacity threshold of row judgement can arrange neatly and adjust according to the actual operation situation of file server and user's needs, so that this capacity threshold is to adapt to current environment facies.For example, this limit value can be set as 1,000,000.
According to capacity threshold, the memory capacity of file is judged, whether excessive to know the file of current transmission, if the determination result is YES time, need the step of carrying out S170 so that the file of current transmission is compressed to processing, avoid file excessive and cause the delayed delivery of file, improve transmission speed and efficiency, if when the determination result is NO, directly send this document.
S170, compresses processing to file, enters S180.
In the present embodiment, call certain compression algorithm the file of current transmission is compressed to processing, to reduce the volume of file.Wherein, the compression algorithm of calling can be Lossy Compression Algorithm and lossless compression algorithm.
S180, sends the file of processing through overcompression.
In the present embodiment, the file through overcompression is sent to file recipient, because whose transmission can not exist the excessive situation of file, therefore, even if network environment is good, also can smoothly and rapidly file not be sent.
S190, Transmit message.
In the present embodiment, when judging when the memory capacity of file whether exceeding capacity threshold the determination result is NO, directly this document is sent.
As shown in Figure 2, in one embodiment, the method also comprises:
S210, sends this document is compressed to the request of processing to recipient.
In the present embodiment, when the memory capacity that determines file has exceeded preset capacity threshold, recipient to file is initiated this document to compress the request of processing, with the recipient to file, be confirmed whether to carry out compressing file, for example, if the recipient of file cannot decompress to the file of compression, can refuse this request, directly carry out the transmission of file.
S230, receives recipient according to the confirmation of request feedback.
In the present embodiment, the recipient of file receive that transmit leg initiates this document is compressed to the request of processing after, if accepted this request, confirmation can be compressed to process to the file that is about to receive and generate corresponding confirmation, and then feeds back to the transmit leg of file the confirmation generating.
The step of above-mentioned S170 is specially: when judgment result is that, be and institute while accounting for confirmation that file is compressed to processing.
In the present embodiment, the memory capacity of file is judged to resulting judgment result is that is and received recipient according to after the confirmation of request feedback, transmit leg will compress processing by certain compression algorithm to the file of current transmission.
As shown in Figure 3, in one embodiment, the step of above-mentioned S170 comprises:
S171, when judgment result is that while being, determines the compression algorithm that has preset corresponding relation with attribute information according to the attribute information of file.
In the present embodiment, the attribute information of the file that transmit leg sends will be varied, different, wherein, attribute information has comprised the file type under this document, for example, the file type that transmit leg sends can comprise the polytypes such as audio frequency, video, picture, text and executable file.
The file of different file types has its applicable compression algorithm, to obtain best compression effectiveness, therefore, will carry out choosing of compress mode according to the file type identifying in attribute information, adopts the compress mode of choosing to compress file.
For example, for file type, be the file of audio frequency, video and/or picture, can adopt Lossy Compression Algorithm, also can adopt lossless compression algorithm, when the file of other file type adopts lossless compression algorithm, row compression is processed.
Further, the corresponding relation between preset attribute information and compression algorithm, in the time need to compressing the file sending, can obtain existing with this attribute information according to attribute information and the relevant corresponding relation of attribute information the compression algorithm of corresponding relation.
Further, the quantity of the file of current transmission can be one or more, when file is while being a plurality of, a plurality of files can be the files that has same alike result information, also can be the different file of attribute information, therefore, by choosing according to the attribute information of each file the compression that exists the compression algorithm of corresponding relation to carry out file with this attribute information respectively, process.
S173, compresses processing according to definite compression algorithm to file.
In one embodiment, this attribute information comprises the first attribute information or the second attribute information, and the method also comprises step:
There is the first corresponding relation in preset the first attribute information and Lossy Compression Algorithm, preset the second attribute information and lossless compression algorithm exist the second corresponding relation.
In the present embodiment, the attribute information of file is divided into the first attribute information and the second attribute information, and each generic attribute information corresponding respectively a compression algorithm, to simplify, the compression of file is processed.
Concrete, the first corresponding relation between preset the first attribute information and Lossy Compression Algorithm, the second corresponding relation between the second attribute information and lossless compression algorithm, in a preferred embodiment, each attribute information can be the attribute informations corresponding to file such as audio frequency, video and picture, and the second attribute information is the corresponding attribute information of the file of other type.
The step of above-mentioned S170 is specially: when judgment result is that, be and when file has the first attribute information, according to the first corresponding relation, use Lossy Compression Algorithm to compress processing to file;
Or
When judgment result is that, be and when file has the second attribute information, according to the second corresponding relation, use lossless compression algorithm to compress processing to file.
In the present embodiment, when the memory capacity of file being judged to judgment result is that of obtaining is, according to the existing attribute information classification of file, carry out choosing of compression algorithm.
As shown in Figure 4, in another embodiment, above-mentioned S170 comprises step:
S175, when judgment result is that while being, the memory capacity of calculation document after overcompression is processed.
In the present embodiment, in the king-sized situation of memory capacity of file, the situation that file after overcompression is processed still exceeds capacity threshold happens occasionally, in the case, if the king-sized file of memory capacity is still adopted conventional compression algorithm to compress and processed is to obtain the little file to capacity threshold of volume, only can improve a little the transmission speed of file, therefore, by to file the memory capacity after overcompression is processed estimate, must obtain corresponding result of calculation.
S177, determines when result of calculation is more than or equal to capacity threshold, according to capacity threshold, to file, divides rolling compression to process.
In the present embodiment, judge whether result of calculation is more than or equal to capacity threshold, to know by certain compression algorithm whether can access the file that is less than capacity threshold, if determine, result of calculation is while being more than or equal to capacity threshold, needing, according to capacity threshold, file is carried out to bundling compression processes, suitable so that memory capacity and the capacity threshold of rear file are processed in bundling compression, if determine, result of calculation is less than capacity threshold and adopts compression algorithm to compress.
The method of above-mentioned Transmit message is described below in conjunction with a specific embodiment.In this embodiment, the JICQ of take illustrates the method for Transmit message as above as example.
Transmit leg is after file transmit operation has been triggered at JICQ interface, the instruction of the transmit leg Transmit message of this operation triggering generation will be received, to obtain the memory capacity of file according to this instruction, and whether the memory capacity that judges this document has exceeded default capacity threshold, when judgment result is that while being, by sending to recipient, this document is compressed to the request of processing, with the recipient to file, be confirmed whether to carry out compressing file, if recipient has refused this document to compress the request of processing, JICQ is directly sent to recipient by file.
If recipient has accepted this document to compress the request of processing, recipient will receive transmit leg according to the confirmation of request feedback, and file is compressed and processes the file sending again after compression is processed.
Further, recipient is receiving transmit leg according to after asking the confirmation of feedback, the compression algorithm that has preset corresponding relation with attribute information will be determined according to the attribute information of file,, there is the first corresponding relation in preset the first attribute information and Lossy Compression Algorithm, there is the second corresponding relation in preset the second attribute information and lossless compression algorithm, if when this document exists the first attribute information, according to the first corresponding relation, uses Lossy Compression Algorithm to compress processing to file; If while there is the second attribute information in file, according to the second corresponding relation, use lossless compression algorithm to compress processing to file, the operational inconvenience of effectively having avoided file file that is too large and that cause to send, has improved the convenience in file transmit operation.
As shown in Figure 5, in one embodiment, a kind of terminal comprisescommand reception module 110, memorycapacity acquisition module 130,judge module 150,compression module 170 and sendingmodule 190.
Command reception module 110, for receiving the instruction of transmit leg Transmit message.
In the present embodiment, side to be sent, after file transmit operation is triggered at the transmission interface of file, will generate the instruction of transmit leg Transmit message.Wherein, the transmission interface of this document can be the client end interface of JICQ, can be also the client end interface of the social instrument of virtual network, can also be the interface of various webpage clients, in addition can be also that other is for realizing the software interface of file transfer.
Memorycapacity acquisition module 130, for the instruction receiving according tocommand reception module 110, obtains the memory capacity of file.
In the present embodiment, memorycapacity acquisition module 130, according to the instruction of transmit leg Transmit message, obtains the memory capacity of file, and wherein, the file that transmit leg is current sent can be a file, can be also a plurality of files.
Judge module 150, for judging whether the memory capacity of the file that memorycapacity acquisition module 130 obtains exceeds preset capacity threshold.
In the present embodiment, the capacity threshold ofjudge module 150 row judgement when whether the memory capacity of file is transfinited can arrange neatly and adjust according to the actual operation situation of file server and user's needs, so that this capacity threshold is to adapt to current environment facies.For example, this limit value can be set as 1,000,000.
Whetherjudge module 150 judges the memory capacity of file according to capacity threshold, excessive to know the file of current transmission, avoids file excessive and cause the delayed delivery of file, improves transmission speed and efficiency.
Compression module 170, for when judgment result is that ofjudge module 150 is, compresses processing to file.
In the present embodiment,compression module 170 calls certain compression algorithm the file of current transmission is compressed to processing, to reduce the volume of file.Wherein, the compression algorithm of calling can be Lossy Compression Algorithm and lossless compression algorithm.
Sendingmodule 190, for sending the file that 170 compressions are processed through compression module.
In the present embodiment, sendingmodule 190 is sent to file recipient by the file through overcompression, because whose transmission can not exist the excessive situation of file, therefore, even if network environment is good, also can smoothly and rapidly file not sent.
Sendingmodule 190 does not also compress and processes direct Transmit message file when the determination result is NO whenjudge module 150.
In the present embodiment, when judging that when the memory capacity of file whether exceeding capacity threshold the determination result is NO, sendingmodule 190 directly sends this document.
As shown in Figure 6, in one embodiment, above-mentioned terminal also comprises request initiation module 210 and confirms receiver module 230.
Request initiation module 210, for sending file compressed to the request of processing to recipient.
In the present embodiment, when the memory capacity that judgemodule 150 determines file has exceeded preset capacity threshold, request initiation module 210 initiates the recipient to file this document is compressed to the request of processing, with the recipient to file, be confirmed whether to carry out compressing file, for example, if the recipient of file cannot decompress to the file of compression, can refuse this request, directly carry out the transmission of file.
Confirm receiver module 230, for receiving recipient according to the confirmation of the request feedback of request initiation module 210 transmissions.
In the present embodiment, the recipient of file receive that transmit leg initiates this document is compressed to the request of processing after, if accepted this request, confirmation can be compressed to process to the file that is about to receive and generate corresponding confirmation, and then feeds back to the transmit leg of file the confirmation generating.
Compression module 170 when when judgment result is that ofjudge module 150 being and confirming that receiver module 230 receives the confirmation information, compresses processing to file.
In the present embodiment, the memory capacity of file is judged to resulting judgment result is that is and received recipient according to after the confirmation of request feedback, and thecompression module 170 of transmit leg will compress processing by certain compression algorithm to the file of current transmission.
As shown in Figure 7, in one embodiment, above-mentionedcompression module 170 comprisesalgorithm determining unit 171 andcompression processing unit 173.
Algorithm determining unit 171, for when judgment result is that while being, determines the compression algorithm that has preset corresponding relation with attribute information according to the attribute information of file.
In the present embodiment, the attribute information of the file that transmit leg sends will be varied, different, wherein, attribute information has comprised the file type under this document, for example, the file type that transmit leg sends can comprise the polytypes such as audio frequency, video, picture, text and executable file.
The file of different file types has its applicable compression algorithm, to obtain best compression effectiveness, therefore,algorithm determining unit 171 will be carried out choosing of compress mode according to the file type identifying in attribute information, adopts the compress mode of choosing to compress file.
For example, for file type, be the file of audio frequency, video and/or picture, can adopt Lossy Compression Algorithm, also can adopt lossless compression algorithm, when the file of other file type adopts lossless compression algorithm, row compression is processed.
Further, the corresponding relation between preset attribute information and compression algorithm, in the time need to compressing the file sending, can obtain existing with this attribute information according to attribute information and the relevant corresponding relation of attribute information the compression algorithm of corresponding relation.
Further, the quantity of the file of current transmission can be one or more, when file is while being a plurality of, a plurality of files can be the files that has same alike result information, also can be the different file of attribute information, therefore,compression processing unit 173 is processed choosing according to the attribute information of each file the compression that exists the compression algorithm of corresponding relation to carry out file with this attribute information respectively.
Compression processing unit 173, for compressing processing according to the definite compression algorithm ofalgorithm determining unit 171 to file.
In another embodiment, attribute information comprises the first attribute information or the second attribute information;
Above-mentioned terminal also comprises preset module, and this preset module exists the first corresponding relation for preset the first attribute information and Lossy Compression Algorithm, and preset the second attribute information and lossless compression algorithm exist the second corresponding relation.
In the present embodiment, the attribute information of file is divided into the first attribute information and the second attribute information, and each generic attribute information corresponding respectively a compression algorithm, to simplify, the compression of file is processed.
Concrete, the first corresponding relation between preset the first attribute information of preset module and Lossy Compression Algorithm, the second corresponding relation between the second attribute information and lossless compression algorithm, in a preferred embodiment, each attribute information can be the attribute informations corresponding to file such as audio frequency, video and picture, and the second attribute information is the corresponding attribute information of the file of other type.
Compression processing unit 173 is specifically for being and when file has the first attribute information, using Lossy Compression Algorithm to compress processing to file according to the first corresponding relation when judgment result is that;
Or
Compression processing unit 173 is specifically for being and when file has the second attribute information, using lossless compression algorithm to compress processing to file according to the second corresponding relation when judgment result is that.
In the present embodiment, when the memory capacity of file being judged to judgment result is that of obtaining is, according to the existing attribute information classification of file, carry out choosing of compression algorithm.
As shown in Figure 8, in one embodiment, above-mentionedcompression module 170 comprises calculation ofcapacity unit 175 and bundlingcompression unit 177.
Calculation ofcapacity unit 175, for when judgment result is that while being, the memory capacity of calculation document after overcompression is processed.
In the present embodiment, in the king-sized situation of memory capacity of file, the situation that file after overcompression is processed still exceeds capacity threshold happens occasionally, in the case, if the king-sized file of memory capacity is still adopted conventional compression algorithm to compress and processed is to obtain the little file to capacity threshold of volume, only can improve a little the transmission speed of file, therefore, calculation ofcapacity unit 175 by file the memory capacity after overcompression is processed estimate, must obtain corresponding result of calculation.
Bundlingcompression unit 177, when determining that the result of calculation of calculation ofcapacity unit 175 is more than or equal to capacity threshold, divide rolling compression processing according to capacity threshold to file.
In the present embodiment, judge whether result of calculation is more than or equal to capacity threshold, if to know by certain compression algorithm whether can access the file that is less than capacity threshold, if determine, result of calculation is while being more than or equal to capacity threshold, needingbundling compression unit 177, according to capacity threshold, file is carried out to bundling compression processes, suitable so that memory capacity and the capacity threshold of rear file are processed in bundling compression, if determine, result of calculation is less than capacity threshold and adopts compression algorithm to compress.
Below in conjunction with a specific embodiment, above-mentioned terminal is described.In this embodiment, this terminal should be after having triggered file transmit operation as the transmission of file,command reception module 110 in terminal will receive the instruction of the transmit leg Transmit message of this operation triggering generation, what memorycapacity acquisition module 130 received according tocommand reception module 110 obtains the memory capacity of file according to this instruction, and judge byjudge module 150 whether the memory capacity of this document has exceeded default capacity threshold, when judgment result is that while being, request initiation module 210 compresses to this document the request of processing by sending to recipient, if recipient has refused this document to compress the request of processing, sendingmodule 190 is directly sent to recipient by file.
If recipient has accepted this document to compress the request of processing, confirm that receiver module 230 receives recipient according to the confirmation of the request feedback of request initiation module 210 transmissions,compression module 170 will compress file and process the file sending again after compression processing.
Further, recipient is receiving transmit leg according to after asking the confirmation of feedback,algorithm determining unit 171 incompression module 170 will be determined the compression algorithm that has preset corresponding relation with attribute information according to the attribute information of file, , preset module in terminal is preset there is the first corresponding relation in the first attribute information and Lossy Compression Algorithm, there is the second corresponding relation in preset the second attribute information and lossless compression algorithm, if while there is the first attribute information in this document,compression processing unit 173 incompression module 170 is used Lossy Compression Algorithm to compress processing to file according to the first corresponding relation, if while there is the second attribute information in file,compression processing unit 173 incompression module 170 is used lossless compression algorithm to compress processing to file according to the second corresponding relation, the operational inconvenience of effectively having avoided file file that is too large and that cause to send, has improved the convenience in file transmit operation.
The method of above-mentioned Transmit message and terminal, receive the instruction of transmit leg Transmit message, according to this instruction, obtain the memory capacity of file, to judge whether the volume of file has exceeded preset capacity threshold, when judgment result is that while being, can compress processing to file, the file that concurrent warp let-off overcompression is processed, therefore, in the situation that the memory capacity of file is excessive, will need transmit leg to carry out extra operation and directly file is compressed, improved the operational convenience that file sends.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, to come the hardware that instruction is relevant to complete by computer program, described program can be stored in a computer read/write memory medium, this program, when carrying out, can comprise as the flow process of the embodiment of above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (Random Access Memory, RAM) etc.
The above embodiment has only expressed several execution mode of the present invention, and it describes comparatively concrete and detailed, but can not therefore be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection range of patent of the present invention should be as the criterion with claims.