CN112036133B - File storage method and device, electronic equipment and storage medium - Google Patents

File storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112036133B
CN112036133B CN202010907159.7A CN202010907159A CN112036133B CN 112036133 B CN112036133 B CN 112036133B CN 202010907159 A CN202010907159 A CN 202010907159A CN 112036133 B CN112036133 B CN 112036133B
Authority
CN
China
Prior art keywords
file
editing operation
original file
storage
editing
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.)
Active
Application number
CN202010907159.7A
Other languages
Chinese (zh)
Other versions
CN112036133A (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.)
Zhuhai Baoqu Technology Co Ltd
Original Assignee
Zhuhai Baoqu Technology Co Ltd
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 Zhuhai Baoqu Technology Co Ltd filed Critical Zhuhai Baoqu Technology Co Ltd
Priority to CN202010907159.7A priority Critical patent/CN112036133B/en
Publication of CN112036133A publication Critical patent/CN112036133A/en
Application granted granted Critical
Publication of CN112036133B publication Critical patent/CN112036133B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Abstract

The embodiment of the invention discloses a file storage method, a device, electronic equipment and a storage medium, which relate to the technical field of computers and can effectively improve the file storage efficiency. The method comprises the following steps: responding to a file saving instruction, and acquiring editing operation undergone by an original file; determining a storage mode corresponding to the editing operation according to the editing operation; and updating and storing the original file based on the determined storage mode. The invention can be used for file preservation.

Description

File storage method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for storing files, an electronic device, and a storage medium.
Background
After the file is edited, the file on the storage medium needs to be updated through a file save operation. A common way of saving a file is to rewrite the entire file on a storage medium once, however, when the file is large, it takes tens of seconds or more to rewrite the file, and the operation efficiency is low.
In order to solve this problem, there is also an incremental saving mode of the file, that is, the modified content of the file is additionally recorded on the basis of keeping the original file content unchanged. However, the incremental storage mode can make the file bigger and bigger, tedious and reduce the effective content ratio of the file.
For the mode of storing the files with large volumes, no effective solution exists in the related technical field.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a method, an apparatus, an electronic device, and a storage medium for storing a file, which can effectively improve the storage efficiency after editing the file.
In a first aspect, an embodiment of the present invention provides a method for saving a file, including:
responding to a file saving instruction, and acquiring editing operation undergone by an original file;
determining a storage mode corresponding to the editing operation according to the editing operation;
and updating and storing the original file based on the determined storage mode.
Optionally, before the editing operation undergone by the original file is acquired in response to the file saving instruction, the method further includes:
marking the adopted editing operation when editing the file to form an operation record;
the editing operation undergone by the original file acquisition comprises the following steps:
and acquiring editing operation undergone by the original file by querying the operation record.
Optionally, the determining, according to the editing operation, a saving mode corresponding to the editing operation includes:
if the editing operation comprises a preset operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner;
the updating and storing the original file based on the determined storing mode comprises the following steps: the original file is entirely replaced by the first file formed after the editing operation and written into a storage address;
if the editing operation does not comprise the preset operation, determining that the storage mode corresponding to the editing operation is incremental storage;
the updating and storing the original file based on the determined storing mode comprises the following steps: the content of the original file is reserved in the storage address, and the operation content corresponding to the editing operation is added to the original file to form a second file;
wherein the preset operation includes at least one of: adding a password operation, removing the password operation and deleting the password operation.
Optionally, the determining, according to the editing operation, a storage manner corresponding to the editing operation includes:
if the editing operation comprises a preset operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; the updating and storing the original file based on the determined storing mode comprises the following steps: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
if the editing operation does not comprise the preset operation, determining a storage mode corresponding to the editing operation according to a comparison result of the file size of the original file and a preset threshold value; the updating and storing the original file based on the determined storing mode comprises the following steps: the original file is entirely replaced by the first file formed after the editing operation and written into a storage address; or reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second file;
the preset operation comprises a password adding operation and/or a password releasing operation.
Optionally, the determining, according to a comparison result of the file size of the original file and a preset threshold, a storage mode corresponding to the editing operation includes:
if the file size of the original file is smaller than or equal to the preset threshold value, determining a storage mode corresponding to the editing operation for rewriting and storing;
and if the file size of the original file is larger than the preset threshold value, determining that the storage mode corresponding to the editing operation is incremental storage.
Optionally, the determining, according to the editing operation, a storage manner corresponding to the editing operation includes:
if the editing operation is a page deleting operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; the updating and storing the original file based on the determined storing mode comprises the following steps: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
if the editing operation is the operation of deleting the non-page, determining that the storage mode corresponding to the editing operation is incremental storage; the updating and storing the original file based on the determined storing mode comprises the following steps: and reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second new file.
In a second aspect, an embodiment of the present invention further provides a file saving apparatus, including:
the acquisition unit is used for responding to the file storage instruction and acquiring editing operation undergone by the original file;
the determining unit is used for determining a storage mode corresponding to the editing operation according to the editing operation;
and the storage unit is used for updating and storing the original file based on the determined storage mode.
Optionally, the device further includes a recording unit, configured to mark the editing operation adopted when editing the file before the editing operation undergone by the original file is acquired in response to the file saving instruction, so as to form an operation record;
the obtaining unit is specifically configured to obtain the editing operation undergone by the original file by querying the operation record.
Optionally, the determining unit is specifically configured to determine, if the editing operation includes a preset operation, that a storage mode corresponding to the editing operation is saved in an overwriting manner; the storage unit is specifically configured to replace the original file with the first file formed after the editing operation, and write the first file into a storage address;
or alternatively
The determining unit is specifically configured to determine that, if the editing operation does not include the preset operation, a storage mode corresponding to the editing operation is incremental storage; the storage unit is specifically configured to store the content of the original file in the storage address, and add the operation content corresponding to the editing operation to the original file to form a second new file;
wherein the preset operation includes at least one of: adding a password operation, removing the password operation and deleting the password operation.
Optionally, the determining unit includes a first determining module, configured to determine, if the editing operation includes a preset operation, that a storage mode corresponding to the editing operation is saved by overwriting; the storage unit is specifically configured to: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
or alternatively
The determining unit comprises a second determining module, and is used for determining a storage mode corresponding to the editing operation according to a comparison result of the file size of the original file and a preset threshold value if the editing operation does not comprise the preset operation; the storage unit is specifically configured to: the original file is entirely replaced by the first file formed after the editing operation and written into a storage address; or reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second file;
the preset operation comprises a password adding operation and/or a password releasing operation.
Optionally, the second determining module is specifically configured to:
if the file size of the original file is smaller than or equal to the preset threshold value, determining a storage mode corresponding to the editing operation for rewriting and storing;
and if the file size of the original file is larger than the preset threshold value, determining that the storage mode corresponding to the editing operation is incremental storage.
Optionally, the determining unit is specifically configured to: if the editing operation is a page deleting operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; the storage unit is specifically configured to: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
or alternatively
The determining unit is specifically configured to: if the editing operation is the operation of deleting the non-page, determining that the storage mode corresponding to the editing operation is incremental storage; the storage unit is specifically configured to: and reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second new file.
In a third aspect, embodiments of the present invention further provide an electronic device, including: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space surrounded by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing any one of the file saving methods provided by the embodiments of the present invention.
In a fourth aspect, embodiments of the present invention also provide a computer-readable storage medium storing one or more programs executable by one or more processors to implement any of the file saving methods provided by the embodiments of the present invention.
According to the file saving method, the device, the electronic equipment and the storage medium, after the file saving instruction is received, editing operations undergone by an original file can be obtained in response to the instruction, and the original file is updated and saved in different saving modes according to different editing operations. Therefore, the file can be saved in an adaptive mode according to different editing operations undergone by the original file, and resources spent for saving the file are minimized on the basis of ensuring the correct content of the file, so that the saving efficiency of the file is effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for saving files according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a file storage device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In a first aspect, an embodiment of the present invention provides a method for saving a file, which can effectively improve the saving efficiency after editing the file.
As shown in fig. 1, the method for saving a file provided by the embodiment of the invention may include:
s11, responding to a file storage instruction, and acquiring editing operation undergone by an original file;
after the user opens the file, various editing operations may be performed on the file, such as entering text, modifying a format, adding comments, and the like. In the embodiment of the invention, when the file is to be saved by clicking a save button or automatically saving the system, the save operation is not directly executed, but the editing operation undergone by the original file is acquired before the save operation is executed. That is, between the current saving and the last saving, which editing operations are performed on the file by the user is obtained.
The files targeted by the file save instruction may include various files supporting incremental save and overwrite save, such as PDF files.
Alternatively, the editing operations that the original document undergoes may include one or more, wherein each editing operation may be performed one or more times.
S12, determining a storage mode corresponding to the editing operation according to the editing operation;
in this step, according to the different editing operations undergone by the original file, different storage modes can be adopted for file storage in a targeted manner, that is, the same original file undergoes different editing operations, the specific storage modes of the file may be different, and the most favorable file storage mode can be selected for file storage.
And S13, updating and storing the original file based on the determined storage mode.
After determining the saving mode corresponding to the editing operation, the original file can be saved by using the saving mode, and the saved content is written into the storage medium.
According to the file saving method provided by the embodiment of the invention, after the file saving instruction is received, the editing operation undergone by the original file can be obtained in response to the instruction, the saving mode corresponding to the editing operation is determined according to the different editing operations, and the original file is updated and saved by adopting different saving modes. Therefore, the file can be saved in an adaptive mode according to different editing operations undergone by the original file, and resources spent for saving the file are minimized on the basis of ensuring the correct content of the file, so that the saving efficiency of the file is effectively improved.
Specifically, in one embodiment of the present invention, before the editing operation undergone by the original file is acquired in response to the file saving instruction in step S11, the file saving method provided by the embodiment of the present invention may further include: marking the adopted editing operation when editing the file to form an operation record; correspondingly, the editing operation performed to obtain the original file in step S11 may specifically include: and acquiring editing operation undergone by the original file by querying the operation record.
The specific form of marking the editing operation is not limited, and various editing operations undergone by the original file can be sequentially recorded in a single file or data structure, and the corresponding editing operation mark can be marked on the mark.
It should be noted that in the embodiment of the present invention, the execution time and order of each editing operation do not need to be known, and the specific number of times each editing operation is executed does not need to be known, but only whether the editing operation is executed or not is known, so that the data size is small, and the data maintenance and the query are convenient.
After the editing operation undergone by the original file is acquired, in step S12, a storage manner corresponding to the editing operation may be determined according to the editing operation.
Optionally, in the embodiment of the present invention, the editing operations are various, and there may be various solutions how to form a correspondence between the editing operations and the saving modes, so as to improve the file saving efficiency. For example, different saving modes may be selected according to whether certain specific operations are included in the editing operation.
Specifically, in one embodiment of the present invention, step S12 may include, according to an editing operation, determining a saving mode corresponding to the editing operation:
if the editing operation comprises a preset operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; based on this, in step S13, the updating and saving the original file based on the determined saving mode includes: when the editing operation comprises a preset operation, the original file is entirely replaced by a first new file formed after the editing operation and written into a storage address;
if the editing operation does not comprise the preset operation, determining that the storage mode corresponding to the editing operation is incremental storage; based on this, in step S13, updating and saving the original file based on the determined saving mode may specifically include: under the condition that the editing operation does not comprise the preset operation, reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second new file;
wherein the preset operation includes at least one of: adding a password operation, removing the password operation and deleting the password operation.
The add password operation may refer to encrypting the file contents, requiring the password to be entered the next time the file is reopened. The delete password operation may refer to decrypting the encrypted file content without entering a password the next time the file is reopened. The delete operation may refer to deleting any content in the file, such as deleting pages, text, pictures, annotations, and the like.
That is, in this embodiment, if any one or more of the operations of adding a password, removing a password, and deleting is included in the editing operation that the original file undergoes, then the original file is written to the save address by replacing the whole of the original file with the first new file formed after the editing operation in the overwrite save mode when the file is saved. If the editing operation, the password adding operation, the password releasing operation and the deleting operation of the original file are not included, an incremental storage mode can be adopted, the content of the original file is reserved in the storage address, and the operation content corresponding to the editing operation is added to the original file to form a second new file.
The rewriting and storing mode can recode the file content so as to realize the password adding operation or the password releasing operation, and after the file is deleted, the file content is relatively reduced, so that the workload of rewriting and storing can be reduced.
Besides the password adding operation, the password releasing operation and the deleting operation, the file can be saved in an incremental saving mode after other editing operations. The incremental saving mode only adds the newly added change after the original file content, and the incremental saving speed is higher because the newly added saved content is usually smaller.
In the above embodiment, the preset operation includes a password adding operation, a password releasing operation, and a deleting operation. Embodiments of the present invention are not limited in this regard and in other embodiments of the present invention, the preset operations may include more or fewer editing operations.
For example, in one embodiment of the present invention, according to the editing operation in step S12, determining the saving mode corresponding to the editing operation may include:
if the editing operation comprises a preset operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; based on this, updating and saving the original file based on the determined saving manner in step S13 may include: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
if the editing operation does not comprise the preset operation, determining a storage mode corresponding to the editing operation according to a comparison result of the file size of the original file and a preset threshold value; based on this, updating and saving the original file based on the determined saving manner in step S13 may include: the original file is entirely replaced by the first file formed after the editing operation and written into a storage address; or reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second file;
the preset operation comprises a password adding operation and/or a password releasing operation.
That is, in this embodiment, the preset operation only includes an add password operation and/or a remove password operation, if the edit operation undergone by the original file includes an add password operation and/or a remove password operation, the file is saved in a manner of rewriting and saving, and if the edit operation undergone by the original file does not include an add password operation and/or a remove password operation, a further determination may be made as to what saving manner is adopted according to the size of the file.
Specifically, in one embodiment of the present invention, according to a comparison result between the file size of the original file and a preset threshold, determining the saving mode corresponding to the editing operation may specifically include:
if the file size of the original file is smaller than or equal to the preset threshold value, determining a storage mode corresponding to the editing operation for rewriting and storing;
and if the file size of the original file is larger than the preset threshold value, determining that the storage mode corresponding to the editing operation is incremental storage.
That is, if the original file size is smaller than or equal to the preset threshold, the file data size is smaller, and it does not take too long to save the file by rewriting the file once, so that the file can be saved by rewriting the file. If the file size of the original file is larger than the preset threshold, the file data size is larger, and the rewriting is more time-consuming, the file storage mode can be selected for file storage, so that the file storage efficiency is effectively improved while the file content is ensured to be correct and the balance is made between the file size and the time spent for file storage.
In the above embodiments, when the file saving mode is selected, whether the editing operation undergone by the original file includes the preset operation is detected, but the embodiment of the present invention is not limited thereto. In other embodiments of the present invention, different ways of saving may be performed depending on whether the editing operation is one of them.
In an embodiment of the present invention, according to the editing operation in step S12, the determining, by the storage manner corresponding to the editing operation, may specifically include:
if the editing operation is a page deleting operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; based on this, in step S13, updating and saving the original file based on the determined saving mode includes: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
if the editing operation is the operation of deleting the non-page, determining that the storage mode corresponding to the editing operation is incremental storage; based on this, in step S13, updating and saving the original file based on the determined saving mode includes: and reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second new file.
In this embodiment, if the editing operation includes only the page deleting operation, the file content of the original file is greatly reduced after the page is deleted, so that more storage space is saved, and therefore, the file can be saved in a manner of overwriting. In contrast, if the editing operation includes only the operation of deleting the non-page, the file content of the original file can be reduced only by a small amount by the operation of deleting the non-page, and the saved storage space is limited, so that the file can be saved in an incremental saving mode, so that more file saving time can be saved.
Of course, in other embodiments of the present invention, the time consumed for file saving and the resources such as space may be balanced according to a variety of factors such as the file size and editing operation, for example, the product of the space saving rate and the time saving rate may be used as an index, and the file saving mode with the highest efficiency may be selected.
Correspondingly, in a second aspect, the embodiment of the invention further provides a file storage device, which can effectively improve the storage efficiency after file editing.
As shown in fig. 2, an embodiment of the present invention provides a file saving apparatus, which may include:
an acquisition unit 31 for acquiring an editing operation undergone by an original file in response to a file save instruction;
a determining unit 32, configured to determine, according to the editing operation, a saving mode corresponding to the editing operation;
and a saving unit 33, configured to update and save the original file based on the determined saving mode.
According to the file storage device provided by the embodiment of the invention, after a file storage instruction is received, editing operations undergone by an original file can be acquired in response to the instruction, storage modes corresponding to the editing operations are determined according to different editing operations, and the original file is updated and stored in different storage modes. Therefore, the file can be saved in an adaptive mode according to different editing operations undergone by the original file, and resources spent for saving the file are minimized on the basis of ensuring the correct content of the file, so that the saving efficiency of the file is effectively improved.
Optionally, the file storing apparatus may further include a recording unit configured to mark the editing operation adopted when editing the file before the editing operation undergone by the original file is acquired in response to the file storing instruction, to form an operation record;
accordingly, the obtaining unit 31 may be specifically configured to obtain the editing operation undergone by the original file by querying the operation record.
Optionally, the determining unit 32 may be specifically configured to determine, if the editing operation includes a preset operation, that a storage mode corresponding to the editing operation is saved by overwriting; a saving unit 33, specifically configured to replace the original file with the first file formed after the editing operation, and write the first file into a saving address;
or alternatively
The determining unit 32 is specifically configured to determine that, if the editing operation does not include the preset operation, a saving mode corresponding to the editing operation is incremental saving; a saving unit 33, specifically configured to save the content of the original file in the saving address, and add the operation content corresponding to the editing operation to the original file to form a second new file;
wherein the preset operation includes at least one of: adding a password operation, removing the password operation and deleting the password operation.
Optionally, the determining unit 32 includes a first determining module, configured to determine, if the editing operation includes a preset operation, that a storage mode corresponding to the editing operation is saved by overwriting; the storage unit 33 is specifically configured to: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
or alternatively
The determining unit 32 includes a second determining module, configured to determine, if the editing operation does not include a preset operation, a storage manner corresponding to the editing operation according to a comparison result between a file size of the original file and a preset threshold; the storage unit 33 is specifically configured to: the original file is entirely replaced by the first file formed after the editing operation and written into a storage address; or reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second file;
the preset operation comprises a password adding operation and/or a password releasing operation.
Optionally, the second determining module is specifically configured to:
if the file size of the original file is smaller than or equal to the preset threshold value, determining a storage mode corresponding to the editing operation for rewriting and storing;
and if the file size of the original file is larger than the preset threshold value, determining that the storage mode corresponding to the editing operation is incremental storage.
Optionally, the determining unit 32 is specifically configured to: if the editing operation is a page deleting operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; the storage unit 33 is specifically configured to: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
or alternatively
The determining unit 32 is specifically configured to: if the editing operation is the operation of deleting the non-page, determining that the storage mode corresponding to the editing operation is incremental storage; the storage unit 33 is specifically configured to: the updating and storing the original file based on the determined storing mode comprises the following steps: and reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second new file.
In a third aspect, an embodiment of the present invention provides an electronic device, which can effectively improve storage efficiency after file editing.
As shown in fig. 3, an electronic device provided by an embodiment of the present invention may include: the processor 52 and the memory 53 are arranged on the circuit board 54, wherein the circuit board 54 is arranged in a space surrounded by the shell 51; a power supply circuit 55 for supplying power to the respective circuits or devices of the above-described electronic apparatus; the memory 53 is for storing executable program code; the processor 52 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 53 for executing the file saving method provided in any of the foregoing embodiments.
The specific implementation of the above steps by the processor 52 and the further implementation of the steps by the processor 52 through the execution of the executable program code may be referred to the description of the foregoing embodiments, and will not be repeated here.
Such electronic devices exist in a variety of forms including, but not limited to:
(1) A mobile communication device: such devices are characterized by mobile communication capabilities and are primarily aimed at providing voice, data communications. Such terminals include: smart phones (e.g., iPhone), multimedia phones, functional phones, and low-end phones, etc.
(2) Ultra mobile personal computer device: such devices are in the category of personal computers, having computing and processing functions, and generally also having mobile internet access characteristics. Such terminals include: PDA, MID, and UMPC devices, etc., such as iPad.
(3) Portable entertainment device: such devices may display and play multimedia content. The device comprises: audio, video players (e.g., iPod), palm game consoles, electronic books, and smart toys and portable car navigation devices.
(4) And (3) a server: the configuration of the server includes a processor, a hard disk, a memory, a system bus, and the like, and the server is similar to a general computer architecture, but is required to provide highly reliable services, and thus has high requirements in terms of processing capacity, stability, reliability, security, scalability, manageability, and the like.
(5) Other electronic devices with data interaction functions.
Accordingly, in a fourth aspect, embodiments of the present invention further provide a computer readable storage medium, where one or more programs are stored, where the one or more programs may be executed by one or more processors, so as to implement any one of the file saving methods provided in the foregoing embodiments, and thus, the corresponding technical effects may also be achieved, which have been described in detail above and will not be repeated herein.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments in part.
For convenience of description, the above apparatus is described as being functionally divided into various units/modules, respectively. Of course, the functions of the various elements/modules may be implemented in the same piece or pieces of software and/or hardware when implementing the present invention.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present invention should be included in the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (12)

1. A method for storing a file, comprising:
responding to a file saving instruction, and acquiring editing operation undergone by an original file;
determining a storage mode corresponding to the editing operation according to the editing operation;
updating and storing the original file based on the determined storage mode;
the determining, according to the editing operation, a saving mode corresponding to the editing operation includes: if the editing operation comprises a preset operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; the updating and storing the original file based on the determined storing mode comprises the following steps: the original file is entirely replaced by the first file formed after the editing operation and written into a storage address;
if the editing operation does not comprise the preset operation, determining that the storage mode corresponding to the editing operation is incremental storage; the updating and storing the original file based on the determined storing mode comprises the following steps: the content of the original file is reserved in the storage address, and the operation content corresponding to the editing operation is added to the original file to form a second file;
wherein the preset operation includes at least one of: adding a password operation, removing the password operation and deleting the password operation.
2. The method of claim 1, wherein the method further comprises, prior to the obtaining the editing operation undergone by the original file in response to the file save instruction:
marking the adopted editing operation when editing the file to form an operation record;
the editing operation undergone by the original file acquisition comprises the following steps:
and acquiring editing operation undergone by the original file by querying the operation record.
3. The method according to claim 1 or 2, wherein the determining, according to the editing operation, a saving mode corresponding to the editing operation includes:
if the editing operation comprises a preset operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner;
the updating and storing the original file based on the determined storing mode comprises the following steps:
the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
if the editing operation does not comprise the preset operation, determining a storage mode corresponding to the editing operation according to a comparison result of the file size of the original file and a preset threshold value;
the updating and storing the original file based on the determined storing mode comprises the following steps:
the original file is entirely replaced by the first file formed after the editing operation and written into a storage address; or reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second file;
the preset operation comprises a password adding operation and/or a password releasing operation.
4. The method of claim 3, wherein determining the storage mode corresponding to the editing operation according to the comparison result of the file size of the original file and the preset threshold value includes:
if the file size of the original file is smaller than or equal to the preset threshold value, determining a storage mode corresponding to the editing operation for rewriting and storing;
and if the file size of the original file is larger than the preset threshold value, determining that the storage mode corresponding to the editing operation is incremental storage.
5. The method according to claim 1 or 2, wherein the determining, according to the editing operation, a saving mode corresponding to the editing operation includes:
if the editing operation is a page deleting operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner;
the updating and storing the original file based on the determined storing mode comprises the following steps:
the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
if the editing operation is the operation of deleting the non-page, determining that the storage mode corresponding to the editing operation is incremental storage;
the updating and storing the original file based on the determined storing mode comprises the following steps: and reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second new file.
6. A document holding apparatus, comprising:
the acquisition unit is used for responding to the file storage instruction and acquiring editing operation undergone by the original file;
the determining unit is used for determining a storage mode corresponding to the editing operation according to the editing operation;
the storage unit is used for updating and storing the original file based on the determined storage mode;
the determining unit is specifically configured to determine, if the editing operation includes a preset operation, that a storage mode corresponding to the editing operation is saved by overwriting; the storage unit is specifically configured to replace the original file with the first file formed after the editing operation, and write the first file into a storage address;
or alternatively
The determining unit is specifically configured to determine that, if the editing operation does not include the preset operation, a storage mode corresponding to the editing operation is incremental storage; the storage unit is specifically configured to store the content of the original file in the storage address, and add the operation content corresponding to the editing operation to the original file to form a second new file;
wherein the preset operation includes at least one of: adding a password operation, removing the password operation and deleting the password operation.
7. The apparatus according to claim 6, further comprising a recording unit configured to mark the editing operation employed when editing the file, before acquiring the editing operation undergone by the original file in response to the file save instruction, to form an operation record;
the obtaining unit is specifically configured to obtain the editing operation undergone by the original file by querying the operation record.
8. The apparatus according to claim 6 or 7, wherein the determining unit includes a first determining module configured to determine, if the editing operation includes a preset operation, that a saving mode corresponding to the editing operation is saved over-write; the storage unit is specifically configured to: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
or alternatively
The determining unit comprises a second determining module, and is used for determining a storage mode corresponding to the editing operation according to a comparison result of the file size of the original file and a preset threshold value if the editing operation does not comprise the preset operation; the storage unit is specifically configured to: the original file is entirely replaced by the first file formed after the editing operation and written into a storage address; or reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second file;
the preset operation comprises a password adding operation and/or a password releasing operation.
9. The apparatus of claim 8, wherein the second determining module is specifically configured to:
if the file size of the original file is smaller than or equal to the preset threshold value, determining a storage mode corresponding to the editing operation for rewriting and storing;
and if the file size of the original file is larger than the preset threshold value, determining that the storage mode corresponding to the editing operation is incremental storage.
10. The apparatus according to claim 6 or 7, wherein the determining unit is specifically configured to: if the editing operation is a page deleting operation, determining a storage mode corresponding to the editing operation to be saved in a rewriting manner; the storage unit is specifically configured to: the original file is replaced by a first new file formed after the editing operation, and the original file is written into a storage address;
or alternatively
The determining unit is specifically configured to: if the editing operation is the operation of deleting the non-page, determining that the storage mode corresponding to the editing operation is incremental storage; the storage unit is specifically configured to: and reserving the content of the original file in the storage address, and adding the operation content corresponding to the editing operation to the original file to form a second new file.
11. An electronic device, the electronic device comprising: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space surrounded by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; a processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory for performing the file saving method of any of the preceding claims 1-5.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium stores one or more programs executable by one or more processors to implement the file saving method of any of the preceding claims 1-5.
CN202010907159.7A 2020-09-01 2020-09-01 File storage method and device, electronic equipment and storage medium Active CN112036133B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010907159.7A CN112036133B (en) 2020-09-01 2020-09-01 File storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010907159.7A CN112036133B (en) 2020-09-01 2020-09-01 File storage method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112036133A CN112036133A (en) 2020-12-04
CN112036133B true CN112036133B (en) 2024-03-26

Family

ID=73591000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010907159.7A Active CN112036133B (en) 2020-09-01 2020-09-01 File storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112036133B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114626349B (en) * 2022-05-16 2022-09-09 西安芯瞳半导体技术有限公司 Non-invasive file editing method, device and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122906A (en) * 2006-08-09 2008-02-13 北京北大方正电子有限公司 Document storing method and system
CN103294658A (en) * 2012-03-02 2013-09-11 北大方正集团有限公司 Document storage method and device
CN107885807A (en) * 2017-11-03 2018-04-06 广州视源电子科技股份有限公司 A kind of file saving method, device, Intelligent flat and storage medium
CN111563065A (en) * 2020-07-09 2020-08-21 北京联想协同科技有限公司 Document storage method and device and computer readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7155465B2 (en) * 2003-04-18 2006-12-26 Lee Howard F Method and apparatus for automatically archiving a file system
US8291310B2 (en) * 2007-08-29 2012-10-16 Oracle International Corporation Delta-saving in XML-based documents

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122906A (en) * 2006-08-09 2008-02-13 北京北大方正电子有限公司 Document storing method and system
CN103294658A (en) * 2012-03-02 2013-09-11 北大方正集团有限公司 Document storage method and device
CN107885807A (en) * 2017-11-03 2018-04-06 广州视源电子科技股份有限公司 A kind of file saving method, device, Intelligent flat and storage medium
CN111563065A (en) * 2020-07-09 2020-08-21 北京联想协同科技有限公司 Document storage method and device and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SaaS平台下知识库构建及文档版本控制与管理;谭政;《中国优秀硕士学位论文全文数据库信息科技辑》(第8期);I138-251 *

Also Published As

Publication number Publication date
CN112036133A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
CN103136243B (en) File system duplicate removal method based on cloud storage and device
CN106649543B (en) Method, device and terminal for recording reading progress
US10664443B2 (en) Method and apparatus for presenting to-be-cleaned data, and electronic device
US20140075301A1 (en) Information processing apparatus, control method, and recording medium
CN103049491A (en) Method and device for managing picture file
CN106855861A (en) File merging method and device and electronic equipment
CN107562372B (en) Electronic equipment, data management method thereof and computer readable storage medium
CN111803917A (en) Resource processing method and device
CN106503069A (en) File sharing method and device
CN115114232A (en) Method, device and medium for enumerating historical version objects
CN106484779B (en) File operation method and device
CN112036133B (en) File storage method and device, electronic equipment and storage medium
CN109213450B (en) Associated metadata deleting method, device and equipment based on flash memory array
CN112000971B (en) File permission recording method, system and related device
CN110704573B (en) Catalog storage method, catalog storage device, computer equipment and storage medium
US20170169044A1 (en) Property retrieval apparatus, method and system
CN111124883A (en) Test case library introduction method, system and equipment based on tree form
CN110929472A (en) Document editing method and device, computer storage medium and terminal
CN111104777A (en) Document editing method and device, computer storage medium and terminal
CN106980685B (en) Data processing method and data processing device
CN112632266B (en) Data writing method and device, computer equipment and readable storage medium
CN112286448B (en) Object access method and device, electronic equipment and machine-readable storage medium
US9064134B1 (en) Method and apparatus for mitigating software vulnerabilities
CN108446144A (en) A kind of application program launching method, device, terminal and storage medium
CN111079375B (en) Information sorting method and device, computer storage medium and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant