Method, device, equipment and product capable of saving mail storage space
By decoding and decoding the encoding used in emails, the problems of large storage space and high storage costs are solved, and the mail storage space is saved and fast lossless recovery is achieved.
Patent Information
- Application Number
- CN202411947528.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, the storage space of emails takes up a large amount of space and the storage cost is high, making it difficult to effectively save mail storage space.
By determining the first type of encoding that needs to be decoded (such as BASE64 encoding or QUOTED-PRINTABLE encoding), the data using the encoding in the original mail is decoded, and the storage file is reduced in space is generated, and the storage file is decoded when needed to be decoded, and the storage file is restored to the original mail.
It effectively reduces the storage space usage during mail storage, while achieving rapid lossless recovery of mail, reducing storage costs.
Smart Images

Figure CN119782268A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of mail storage, and in particular relates to a method, device, equipment and product capable of saving mail storage space. Background Art
[0002] With the continuous development of information technology, email systems have been widely used. As emails are used more and more frequently, massive amounts of emails are constantly being generated. How to save email storage space has become an issue of increasing concern to technical personnel. Under existing technical conditions, storing all or part of emails on the computer's local hard disk or network database or network disk still has the problem of large email storage space occupation and high storage cost. Summary of the Invention
[0003] In view of this, the present invention aims to overcome the defects in the prior art and proposes a method, device, equipment and product that can save email storage space.
[0004] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0005] In a first aspect, the present invention discloses a method for saving email storage space, comprising:
[0006] Determine the first type of code that needs to be decoded;
[0007] Decoding the original data encoded using the first type in the original email, and using the decoded data to replace the original data encoded using the first type in the original email, thereby generating a storage file that takes up less space;
[0008] According to the first type of encoding, the decoding result in the storage file is de-decoded to obtain the restored original email.
[0009] In one embodiment of the present invention, the original data encoded using the first type in the original email is decoded, and the decoded result is used to replace the original data encoded using the first type in the original email to generate a storage file with reduced space occupation, which also includes:
[0010] In the original email, search for original data that meets the first type of encoding from the head to the tail of the original email. If no original data that meets the first type of encoding is found, all the original data are copied to a blank new file as a storage file, and record data is added to the top of the storage file. The record data includes the data type and data length of the copied original data.
[0011] In one embodiment of the present invention, decoding original data encoded using the first type in an original email and using the decoded data to replace the original data encoded using the first type in the original email to generate a storage file with reduced space usage includes:
[0012] In the original email, original data that conforms to the first type of encoding is found, and according to the arrangement order of the original data parts that do not conform to the first type of encoding and the original data parts that conform to the first type of encoding in the original data, they are copied one by one into a blank new file to form a storage file, and the record data corresponding to each part of the data is added on the top of this part of the data, wherein copying the original data that conforms to the first type of encoding is copying the data after being decoded according to the first type of encoding.
[0013] In one embodiment of the present invention, the decoding result in the storage file is reverse-decoded according to the first type of encoding to obtain the recovered original email, including: searching for record data from the head to the tail of the storage file, if the data type of the record data is original data that does not conform to the first type of encoding, directly copying the corresponding data part to the newly created file, if the data type of the record data is original data that conforms to the first type of encoding, then the corresponding data part is reverse-decoded according to the first type of encoding and copied to the newly created file; after all the data parts corresponding to the record data are copied to the newly created file in the order of the record data, the newly created file is used as the recovered original email.
[0014] In one embodiment of the present invention, the first type of encoding is BASE64 encoding or QUOTED-PRINTABLE encoding.
[0015] In one embodiment of the present invention, when the original data does not conform to the first type of encoding, the corresponding data type is recorded as the original data.
[0016] In a second aspect, the present invention discloses a device capable of saving mail storage space, the device comprising:
[0017] A coding determination module, configured to determine a first type of coding that needs to be decoded;
[0018] A storage file generation module is used to decode the original data encoded using the first type in the original email, and use the decoding result to replace the original data encoded using the first type in the original email, thereby generating a storage file with reduced space occupation;
[0019] The recovery module is used to de-decode the decoding result in the storage file according to the first type of encoding to obtain the recovered original email.
[0020] In a third aspect, the present invention discloses an electronic device comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above method.
[0021] In a fourth aspect, the present invention discloses a computer-readable storage medium having a computer program stored thereon, which implements the above method when executed by a processor.
[0022] In a fourth aspect, the present invention discloses a computer program product, comprising a computer program, which implements the above method when executed by a processor.
[0023] Compared with the prior art, the present invention has the following advantages:
[0024] The present invention discloses a method, apparatus, equipment and product capable of saving mail storage space, comprising determining a first type of encoding that needs to be decoded; decoding original data in the original mail that uses the first type of encoding, and using the decoding result to replace the original data in the original mail that uses the first type of encoding to generate a storage file that reduces the space occupied; de-decoding the decoding result in the storage file according to the first type of encoding to obtain the restored original mail; the present invention discloses a method, apparatus, equipment and product capable of saving mail storage space, by converting the original data in the original mail that occupies a large space into data that occupies a relatively small space by means of decoding and then storing the data, thereby effectively reducing the storage space occupied by the original mail when it is stored. At the same time, the stored mail can be quickly de-decoded to restore it to the original mail. The method disclosed by the present invention has the characteristics of small mail storage space occupation and fast and lossless mail recovery. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0026] In the attached figure:
[0027] Figure 1 A schematic diagram of an application scenario of a method for saving email storage space according to an embodiment of the present invention;
[0028] Figure 2 A schematic flow chart of a method for saving email storage space according to an embodiment of the present invention;
[0029] Figure 3 A schematic diagram of a storage file generated by a method for saving email storage space according to an embodiment of the present invention;
[0030] Figure 4 A schematic diagram of restoring original emails according to an embodiment of the present invention, which is a method for saving email storage space;
[0031] Figure 5 A schematic diagram of a device capable of saving email storage space according to an embodiment of the present invention;
[0032] Figure 6 A schematic diagram of an electronic device capable of saving email storage space according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0034] In the description of the present invention, it should be further clarified that the terms "first," "second," etc. are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature specified as "first," "second," etc. may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0035] Figure 1 The present invention is a schematic diagram of an application scenario of a method, device, equipment, and product capable of saving email storage space. Under existing technical conditions, storing all or part of an email in a local hard disk of a computer or a network database or network disk still has the problem of large email storage space occupation and high storage cost. The present invention discloses a method, device, equipment, and product capable of saving email storage space, comprising determining a first type of encoding that needs to be decoded; decoding original data in the original email using the first type of encoding, and using the decoded result to replace the original data in the original email using the first type of encoding to generate a storage file that reduces the space occupation; de-decoding the decoded result in the storage file according to the first type of encoding to obtain the restored original email; The present invention discloses a method, device, equipment, and product capable of saving email storage space. By converting the original data in the original email that occupies a large space into data that occupies a relatively small space by decoding and then storing it, the storage space occupied by the original email can be effectively reduced. At the same time, the stored email can be quickly de-decoded to restore it to the original email. The method disclosed by the present invention has the characteristics of small email storage space occupation and fast and lossless email recovery.
[0036] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0037] In one embodiment of the present invention, Figure 2A method for saving email storage space includes:
[0038] Step S201: Determine the first type of code that needs to be decoded;
[0039] The first type of encoding is BASE64 encoding or QUOTED-PRINTABLE encoding.
[0040] In this embodiment, BASE64 encoding is a method for representing binary data based on 64 printable characters, and its basic content is defined in RFC2045-RFC2049.
[0041] Step S202: Decode the original data encoded using the first type in the original email, and use the decoded result to replace the original data encoded using the first type in the original email, thereby generating a storage file with reduced space occupation;
[0042] For example, if the original email contains a large amount of BASE64-encoded content, the original email will occupy more storage space. For example, the string 123456 takes up 6 bytes. If it is in BASE64 encoding form, it corresponds to MTIzNDU2, which takes up 8 bytes. Therefore, converting the BASE64-encoded content before storing the email can effectively reduce storage space.
[0043] Step S203: Decode the decoded result in the stored file according to the first type of encoding to obtain the restored original email.
[0044] The technical solution disclosed in this embodiment can convert part of the content in the original email into data that occupies less space before storing it by decoding, which can effectively reduce the storage space occupied by the original email when it is stored. At the same time, the stored email can be quickly de-decoded and restored to the original email. Therefore, it has the advantages of small email storage space and fast and lossless email recovery.
[0045] Based on the previous embodiment, in another embodiment of the present invention, step S202, decoding the original data in the original email using the first type of encoding, and using the decoding result to replace the original data in the original email using the first type of encoding to generate a storage file with reduced space occupation, also includes:
[0046] In the original email, search for original data that meets the first type of encoding from the head to the tail of the original email. If no original data that meets the first type of encoding is found, all the original data are copied to a blank new file as a storage file, and record data is added to the top of the storage file. The record data includes the data type and data length of the copied original data.
[0047] When the original data does not conform to the first type of coding, the corresponding data type is recorded as original data.
[0048] In this embodiment, the data type is represented by type, the original data type is represented by plain, and the base64 data type is represented by base64. For example, type=plain or type=base64. The data length is represented by length. For example, length=12345.
[0049] On the basis of the previous embodiment, in another embodiment of the present invention, as Figure 2 and Figure 3 As shown, step S202, decoding the original data in the original email using the first type of encoding, and using the decoding result to replace the original data in the original email using the first type of encoding to generate a storage file with reduced space, includes:
[0050] In the original email, original data that conforms to the first type of encoding is found, and according to the arrangement order of the original data parts that do not conform to the first type of encoding and the original data parts that conform to the first type of encoding in the original data, they are copied one by one into a blank new file to form a storage file, and the record data corresponding to each part of the data is added on the top of this part of the data, wherein copying the original data that conforms to the first type of encoding is copying the data after being decoded according to the first type of encoding.
[0051] In this embodiment, since the original data that conforms to the first type of coding is the data decoded according to the first type of coding, this part of data effectively reduces the storage space occupied, thereby saving the storage space of the email.
[0052] In this embodiment, an exemplary implementation is as follows:
[0053] Step 1: Create a new file;
[0054] Step 2: Open the original email and search for the base64-encoded data from the beginning of the file to the end of the file;
[0055] Step 3: Copy the data between the file header and the search base64 encoded data into the new file, and add the corresponding record data on top of this data;
[0056] Step 4: Decode the found base64-encoded data using base64 encoding and copy it to the newly created file, and add the corresponding record data on top of this data;
[0057] Step 5: Continue searching for the base64-encoded data at the end of the file, and repeat steps 3 and 4 until the conversion of the original email is completed and the stored file is obtained.
[0058] In this embodiment, the length of each segment of copied data can be determined by recording the file offset length between the search start point and the search end point.
[0059] In another embodiment of the present invention, Figure 2 and Figure 4 As shown, step S203, according to the first type of encoding, the decoding result in the storage file is reversely decoded to obtain the restored original email, including: searching for record data from the head to the tail of the storage file, if the data type of the record data is original data that does not conform to the first type of encoding, directly copying the corresponding data part to the newly created file, if the data type of the record data is original data that conforms to the first type of encoding, then the corresponding data part is reversely decoded according to the first type of encoding and copied to the newly created file; after the data parts corresponding to all the record data are copied to the newly created file in the order of the record data, the newly created file is used as the restored original email.
[0060] In this embodiment, an exemplary implementation is as follows:
[0061] Step 1: Create a new file;
[0062] Step 2: Open the storage file and search for record data from the beginning to the end of the storage file;
[0063] Step 3: If the data type of the recorded data is original data that does not conform to the first type of encoding, the corresponding data portion is directly copied to the newly created file. If the data type of the recorded data is original data that conforms to the first type of encoding, the corresponding data portion is de-decoded according to the first type of encoding and then copied to the newly created file.
[0064] Step 4: Continue searching for record data towards the end of the file and execute step 3 again. When all the data parts corresponding to the record data are copied to the newly created file in the order of the record data, the newly created file will be used as the recovered original email.
[0065] In this embodiment, the data length of the data portion to be copied and whether decryption is required are determined based on the recorded data.
[0066] like Figure 5 As shown, the present invention also discloses a device capable of saving mail storage space, comprising:
[0067] A coding determination module 501 is configured to determine a first type of coding that needs to be decoded;
[0068] A storage file generating module 502 is configured to decode the original data encoded using the first type in the original email and replace the original data encoded using the first type in the original email with the decoded data, thereby generating a storage file that occupies less space.
[0069] The recovery module 503 is configured to perform reverse decoding on the decoding result in the storage file according to the first type of encoding to obtain the recovered original email.
[0070] The present invention also discloses an electronic device, such as Figure 6 As shown, an embodiment is disclosed, which is a block diagram of the electronic device capable of saving email storage space.
[0071] The electronic device 60 of this embodiment includes a processor 601, which can perform various appropriate actions and processes according to the program stored in the ROM 602 or the program loaded from the storage part 608 into the RAM 603. The processor 601 may include, for example, a general-purpose microprocessor, an instruction set processor and / or a related chipset and / or a dedicated microprocessor, etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present invention.
[0072] RAM 603 stores various programs and data required for the operation of electronic device 60. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 executes the programs in ROM 602 and / or RAM 603 to perform various operations according to the method flow of the embodiment of the present invention. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603, and processor 601 may also execute the programs stored in one or more memories to perform various operations according to the method flow of the embodiment of the present invention.
[0073] According to an embodiment of the present invention, the electronic device 60 may further include an I / O interface 605, which is also connected to the bus 604. The electronic device 60 may further include one or more of the following components connected to the I / O interface 605: an input unit 606 including a keyboard, a mouse, etc.; an output unit 607 including a cathode ray tube, a liquid crystal display, and a speaker; a storage unit 608 including a hard disk; and a communication unit 609 including a network interface card such as a LAN card or a modem. The communication unit 609 performs communication processing via a network such as the Internet. A drive 6010 is also connected to the I / O interface 605 as needed. Removable media 6011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed in the drive 6010 as needed, so that computer programs read therefrom can be installed into the storage unit 608 as needed.
[0074] The present invention also provides a computer-readable storage medium.
[0075] The computer-readable storage medium may be included in the electronic device / device system described in the above embodiments, or may exist independently and not be incorporated into the electronic device / device. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of the present invention.
[0076] According to embodiments of the present invention, a computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples include, but are not limited to, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0077] Embodiments of the present invention also include a computer program product.
[0078] The computer program product includes a computer program, which contains program code for executing the method provided by the embodiment of the present invention. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the method provided by the embodiment of the present invention.
[0079] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal over a network medium. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0080] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written by any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedural and / or object-oriented programming languages. Programming languages include, but are not limited to, Java, C++, Python, C language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network or a wide area network, or can be connected to an external computing device.
[0081] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of the systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the boxes may occur in an order different from that marked in the accompanying drawings. For example, two boxes shown in succession may actually be executed substantially in parallel, or they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, as well as the combination of boxes in the block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or may be implemented using a combination of dedicated hardware and computer instructions. It will be understood by those skilled in the art that the features described in the various embodiments and / or claims of the present invention may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments and / or claims of the present invention may be combined and / or coupled in various ways, and all such combinations and / or couplings fall within the scope of the present invention.
[0082] The embodiments of the present invention have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present invention. Although each embodiment has been described above separately, this does not mean that the measures in each embodiment cannot be advantageously used in combination. The scope of the present invention is defined by the appended claims and their equivalents. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. A method for saving mail storage space, characterized in that: include: Determine the first type of code that needs to be decoded; Decoding the original data encoded using the first type in the original email, and using the decoding result to replace the original data encoded using the first type in the original email, to generate a storage file that reduces the space occupied; According to the first type of encoding, the decoding result in the storage file is reversely decoded to obtain the restored original email.
2. A method for saving mail storage space according to claim 1, characterized in that: The decoding of the original data in the original email using the first type of encoding and using the decoding result to replace the original data in the original email using the first type of encoding to generate a storage file with reduced space occupation may also include: In the original email, search for the original data that conforms to the first type of encoding from the head to the tail of the original email. If the original data that conforms to the first type of encoding is not found, all the original data are copied to a blank new file as the storage file, and record data is added to the top of the storage file. The record data includes the data type and data length of the copied original data.
3. A method for saving mail storage space according to claim 2, characterized in that: The decoding of the original data in the original email using the first type of encoding and using the decoding result to replace the original data in the original email using the first type of encoding to generate a storage file with reduced space occupation includes: In the original email, the original data that conforms to the first type of encoding is found, and according to the arrangement order of the original data parts that do not conform to the first type of encoding and the original data parts that conform to the first type of encoding in the original data, they are copied one by one into a blank new file to form the storage file, and the record data corresponding to each part of the data is added on the top of this part of the data, wherein copying the original data that conforms to the first type of encoding is copying the data decoded according to the first type of encoding.
4. A method for saving mail storage space according to claim 2, characterized in that: The method of de-decoding the decoding result in the storage file according to the first type of encoding to obtain the restored original email includes: searching for the record data from the head to the tail of the storage file, and directly copying the corresponding data part to the newly created file if the data type recorded in the record data is the original data that does not conform to the first type of encoding; if the data type recorded in the record data is the original data that conforms to the first type of encoding, the corresponding data part is de-decoded according to the first type of encoding and then copied to the newly created file; after all the data parts corresponding to the record data are copied to the newly created file in the arrangement order of the record data, the newly created file is used as the restored original email.
5. A method for saving mail storage space according to claim 1, characterized in that: The first type of encoding is BASE64 encoding or QUOTED-PRINTABLE encoding.
6. A method for saving mail storage space according to claim 2, characterized in that: When the original data does not conform to the first type of encoding, the corresponding data type is recorded as original data.
7. A device capable of saving mail storage space, characterized in that: The device comprises: A coding determination module, used for determining a first type of coding that needs to be decoded; A storage file generation module, used for decoding the original data encoded using the first type in the original email, and using the decoding result to replace the original data encoded using the first type in the original email, so as to generate a storage file with reduced space; The recovery module is used to reversely decode the decoding result in the storage file according to the first type of encoding to obtain the recovered original email.
8. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.