[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN118034895A - File previewing method and related device - Google Patents

File previewing method and related device Download PDF

Info

Publication number
CN118034895A
CN118034895A CN202211372498.5A CN202211372498A CN118034895A CN 118034895 A CN118034895 A CN 118034895A CN 202211372498 A CN202211372498 A CN 202211372498A CN 118034895 A CN118034895 A CN 118034895A
Authority
CN
China
Prior art keywords
file
target
target file
resource
engine
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.)
Pending
Application number
CN202211372498.5A
Other languages
Chinese (zh)
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.)
Tencent Technology Beijing Co Ltd
Original Assignee
Tencent Technology Beijing 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 Tencent Technology Beijing Co Ltd filed Critical Tencent Technology Beijing Co Ltd
Priority to CN202211372498.5A priority Critical patent/CN118034895A/en
Publication of CN118034895A publication Critical patent/CN118034895A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • 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
    • G06F16/168Details of user interfaces specifically adapted to file systems, e.g. browsing and visualisation, 2d or 3d GUIs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a file previewing method, which is characterized in that when a previewing service is provided, a target previewing task for a target file is acquired, corresponding target file engine resources are acquired according to the target file type of the target file, and are loaded in a memory, and the target file corresponding to the target previewing task can be previewed and displayed through the loaded target file engine resources. Because the target file engine resource is one of a plurality of file engine resources for previewing different file types, the whole file engine resources do not need to be loaded in a memory, and thus the file previewing service loaded on demand is realized. The loading amount of the file engine resources can be reduced in a loading-on-demand mode, so that the response efficiency of file preview is improved, useless file engine resources cannot be loaded in the memory, and the invalid occupation of the memory is reduced. The file engine resource can be stored in a resource server, and targeted reading is performed when preview requirements exist.

Description

File previewing method and related device
Technical Field
The present application relates to the field of data processing, and in particular, to a file previewing method and related apparatus.
Background
With the development of computer technology, terminal devices may provide a service for file previewing. When file previewing is required, the terminal device may support a file preview service of a plurality of file formats (e.g., txt, pdf, xls, doc, etc.) by initializing a file preview engine.
When the file preview engine provides the preview service of the file to be previewed, the file engine resources corresponding to the file to be previewed need to be read, so in the related art, the terminal equipment loads the file engine resource sets corresponding to different file formats into the memory for standby when the file preview engine is initialized, and the mode can prolong the initialization time of the file preview engine and reduce the file preview efficiency.
Disclosure of Invention
In order to solve the technical problems, the application provides a file previewing method and a related device, which not only improve the response efficiency of file previewing, but also can not load useless file engine resources in a memory, thereby reducing the invalid occupation of the memory.
The embodiment of the application discloses the following technical scheme:
In one aspect, an embodiment of the present application provides a file previewing method, where the method includes:
acquiring a target preview task aiming at a target file through a file preview interface, wherein the target preview task comprises a target file type of the target file;
acquiring a target file engine resource corresponding to the target file type according to the target file type;
loading the target file engine resource in a memory;
And previewing and displaying the target file corresponding to the target preview task through the loaded target file engine resource.
On the other hand, the embodiment of the application provides a file previewing device, which comprises an acquisition unit, a loading unit and a previewing unit:
The acquisition unit is used for acquiring a target preview task aiming at a target file through a file preview interface, wherein the target preview task comprises a target file type of the target file;
the acquisition unit is also used for acquiring target file engine resources corresponding to the target file type according to the target file type;
the loading unit is used for loading the target file engine resource in the memory;
And the preview unit is used for previewing and displaying the target file corresponding to the target preview task through the loaded target file engine resource.
In another aspect, an embodiment of the present application provides a computer device including a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
The processor is configured to perform the method of the above aspect according to instructions in the program code.
In another aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program for performing the method described in the above aspect.
In another aspect, embodiments of the present application provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of the above aspect.
According to the technical scheme, when the preview service is provided, the target preview task for the target file is acquired through the file preview interface, the corresponding target file engine resource is acquired according to the target file type of the target file, and is loaded in the memory, and the target file corresponding to the target preview task can be previewed and displayed through the loaded target file engine resource. Because the target file engine resource is one of a plurality of file engine resources for previewing different file types, namely when the preview requirement is determined to be the target file type, the service meeting the preview requirement can be provided by only loading the engine resource aiming at the target file type into the memory without loading all the plurality of file engine resources in the memory, thereby realizing the file preview service loaded on demand. The loading amount of the file engine resources can be reduced in a loading-on-demand mode, so that the response efficiency of file preview is improved, useless file engine resources cannot be loaded in the memory, and the invalid occupation of the memory is reduced.
Drawings
In order to more clearly illustrate the embodiments of the application 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 application, 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 flow chart of a method of previewing files;
Fig. 2 is a schematic diagram of a file preview scene according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for previewing a document according to an embodiment of the present application;
FIG. 4 is a schematic diagram of resource types of a file engine resource according to an embodiment of the present application;
FIG. 5 is a functional block diagram of a file preview system according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating loading of a file engine resource according to an embodiment of the present application;
FIG. 7 is an overall flowchart of a file previewing method according to an embodiment of the present application;
FIG. 8 is a block diagram of a document previewing apparatus according to an embodiment of the present application;
Fig. 9 is a block diagram of a terminal device according to an embodiment of the present application;
fig. 10 is a block diagram of a server according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
The terminal device may support a file preview service in a plurality of file formats (e.g., txt, pdf, xls, doc, etc.) through a file preview engine. When the file preview engine provides the preview service of the file to be previewed, the file engine resource corresponding to the file to be previewed needs to be read.
In the related file engine technical scheme, the file preview engine is externally provided with services by a software development kit (Software Development Kit, SDK) as a whole, and when the file preview engine needs to provide file preview services, the resource files related to the file engine are loaded into the memory as a whole when the file preview engine is initialized. In the related art, the overall usage flow of the file preview engine is as shown in fig. 1:
1. The full amount of file engine resources and engine core application programming interfaces (Application Program Interface, APIs) are SDK integrated to get the corresponding applications.
2. And the integrated application is installed on the client, and the operating system copies the file engine resource to the corresponding installation path in the installation process of the application.
3. When the user is determined to have file preview requirements, initializing a file preview engine, wherein an initializing method of a file engine SDK is called in an application starting process, and an operating system automatically loads all file engine resources under an application installation path into a memory, namely loads the full file engine resources.
4. When the interface of the file preview is called, based on the file type corresponding to the file preview, directly acquiring the file engine resource corresponding to the file type from the full file engine resource loaded in the memory so as to execute the file preview.
As can be seen, the related art file preview scheme has at least the following problems:
1. The SDK corresponding to the file preview engine is oversized. Specifically, an SDK including a full amount of file engine resources is provided for all cpu platforms, the size of the SDK being about 15M.
2. And the memory occupation is large during operation. The full amount of file engine resources are loaded into the memory (whether related to the current file preview or not) by the operating system when the file preview engine is initialized, and thus, a large memory occupation exists.
Therefore, the embodiment of the application provides a file previewing method, which adopts a mode of loading according to the requirement to provide file previewing service, and can reduce the loading amount of file engine resources, thereby not only improving the response efficiency of file previewing, but also avoiding loading useless file engine resources in a memory and reducing the invalid occupation of the memory.
The file previewing method provided by the embodiment of the application can be implemented through computer equipment, wherein the computer equipment can be terminal equipment or a server, the server can be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and a cloud server for providing cloud computing service. Terminal devices include, but are not limited to, cell phones, computers, intelligent voice interaction devices, intelligent home appliances, vehicle terminals, aircraft, and the like. The terminal device and the server may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
Embodiments of the present application may also relate to cloud technology, including cloud storage in particular.
Cloud storage (cloud storage) is a new concept that extends and develops in the concept of cloud computing, and a distributed cloud storage system (hereinafter referred to as a storage system for short) refers to a storage system that integrates a large number of storage devices (storage devices are also referred to as storage nodes) of various types in a network to work cooperatively through application software or application interfaces through functions such as cluster application, grid technology, and a distributed storage file system, so as to provide data storage and service access functions for the outside.
For example, the file engine resource in the application can be stored in a resource server in the cloud, and when the terminal equipment needs to preview the file, the required file engine resource is read from the resource server.
Fig. 2 is a schematic view of a file preview scene provided in an embodiment of the present application, in which a terminal device 100 is taken as an example of the foregoing computer device.
After the terminal device 100 initializes the file preview engine, a target preview task for the target file may be acquired through the file preview interface, and it is determined that a preview service for the target preview task needs to be provided for the user. The target preview task carries a target file type corresponding to the target file, for example, a word file type.
The terminal device 100 acquires a target file engine resource corresponding to the word file type based on the word file type, and the target file engine resource can be used for providing file previews of the word file type. The terminal device 100 loads the target file engine resource into the memory, and the loaded target file engine resource can preview the target file corresponding to the target preview task.
The file preview engine has the function of previewing files of different file types, one of which is the target file type, for example in the scenario of fig. 1, the file preview engine has the function of previewing files of three file types (PDF, word and txt).
Correspondingly, the file preview engine is further configured with file engine resources corresponding to the different file types respectively, the target file engine resource is one of a plurality of file engine resources for previewing the different file types, for example, in the scenario of fig. 1, the file preview engine is configured with three file engine resources corresponding to the three file types one by one, namely, PDF type resources, word type resources and txt type resources, which are configured in the resource server 200.
That is, when determining that the preview requirement is the target file type, the terminal device 100 only needs to obtain the engine resource (e.g. word type resource) for the target file type from the resource server 200 and load the engine resource into the memory to provide the service for meeting the preview requirement, and does not need to load all the plurality of file engine resources into the memory, for example, the terminal device 100 in fig. 1 does not need to load all the three file engine resources into the memory, but only needs to load the file engine resource corresponding to the word file type into the memory to provide the preview service meeting the reservation requirement of the user.
Therefore, the file preview service loaded on demand is realized, and the loading amount of file engine resources can be reduced in a mode of loading on demand, so that the response efficiency of file preview is improved, useless file engine resources cannot be loaded in the memory, and the invalid occupation of the memory is reduced.
Fig. 3 is a flowchart of a method for previewing a file according to an embodiment of the present application, where in this embodiment, a terminal device is taken as an example of the foregoing computer device, and the method includes:
s301: and acquiring a target preview task aiming at the target file through a file preview interface.
In the embodiment of the application, the file preview engine provides file preview service for users. The file preview interface may be provided by an engine core API of the file preview engine, and the file preview interface (openfile interface) may be called when the user tries to open the target file, through which the terminal device may obtain a corresponding target preview task based on an interface parameter corresponding to the current preview requirement, where the target preview task includes a target file type of the target file. Through the target preview task, the terminal device can clearly indicate that the user has a preview requirement for previewing the target file.
The target file type may be one of the file types that the file preview engine can provide preview services for identifying the file format, source, etc. of the target file.
In one possible implementation, the file preview engine may be decoupled in the present application into two parts, an engine core API and a file engine resource, respectively. By decoupling and splitting the file preview engine, only the engine core API can be encapsulated when the SDK is encapsulated, and the file engine resource can be deployed at the server side, and after the user preview requirement is determined, the file engine resource is loaded in a targeted reading mode based on the file type corresponding to the requirement.
Where the engine core API of the file preview engine can be understood as the portal or interface proxy layer that completes the preview business process. When the openfile interface provided by the engine core API is called, service logic in the file preview engine is not directly called, but openfileIMPL is called, and after the installation and loading flow and version confirmation flow of the file engine resource are completed in the interface Implementation (IMPL), the service logic of openfile (open file) in the file preview engine is called. I.e. the engine core API mainly comprises interface definitions, while the interface implementation sinks into the file engine resources. Because the file engine resources are dynamically loaded as required, the file engine resources do not need to be loaded when the file preview engine is initialized, and decoupling between the engine core API and the file engine resources is realized.
Because the data volume of the engine core API is small compared with the file preview engine, and is about 300kb in general, the data volume of the SDK packaged by the engine core API is much smaller than that of the SDK packaged by all the file preview engines in the related technology, and the SDK is very convenient to transmit and install. The decoupled file engine resource can be stored in a cloud, such as a resource server, and then downloaded to the terminal device after the terminal device installs the file preview engine, or downloaded to the terminal device as required after the user preview requirement is acquired.
S302: and acquiring the target file engine resource corresponding to the target file type according to the target file type.
As described above, the file preview engine may provide preview services for files of multiple file types, and corresponding file engine resources are configured for file preview functions of different file types.
The file engine resource is a resource for realizing file preview of the file preview engine, and can comprise various native library files, java library files and the like realized by the file preview capability, and different file types correspond to different file engine resources. For example, when the file preview engine is provided with a function of providing file preview for three file types of files, the file preview engine has three file engine resources, which are in one-to-one correspondence with the three file types.
In order to realize the on-demand loading of the file engine resources, the situation that the whole file engine resources are loaded in full in the related art is avoided, and the target file engine resources meeting the user preview requirement are determined from a plurality of file engine resources according to the user preview requirement indicated by the target file type, so that the preview of the target file can be realized only under the condition that the target file engine resources are loaded in a memory, and the file preview requirement of a user is met.
The application is not limited to where the terminal device obtains the target file engine resource, e.g. the terminal device may obtain the target file engine resource locally or from a resource server, which will be described in detail in the following embodiments.
S303: and loading the target file engine resource in a memory.
After the terminal equipment obtains the target file engine resource corresponding to the target file type, the target file engine resource can be loaded in the local memory. Because the target file engine resource is the resource required by the file preview engine for previewing the file of the target file type, the terminal equipment can preview the target file without loading other file engine resources of the file preview engine in the memory, thereby reducing the loading amount of the file engine resource in the memory, realizing the on-demand loading aiming at the preview requirement of the user and improving the memory occupation efficiency.
S304: and previewing and displaying the target file corresponding to the target preview task through the loaded target file engine resource.
After the terminal equipment successfully loads the target file engine resource into the memory, the file preview engine can preview the target file through the loaded target file engine resource, so that a user can see the target file displayed by preview.
Moreover, as only the target file engine resource in the plurality of file engine resources is needed to be loaded in the memory, the file preview engine can be greatly improved
Therefore, when the terminal equipment provides the preview service, the target preview task for the target file is obtained through the file preview interface, the corresponding target file engine resource is obtained according to the target file type of the target file, and is loaded in the memory, and the target file corresponding to the target preview task can be previewed and displayed through the loaded target file engine resource. Because the target file engine resource is one of a plurality of file engine resources for previewing different file types, namely when the preview requirement is determined to be the target file type, the service meeting the preview requirement can be provided by only loading the engine resource aiming at the target file type into the memory without loading all the plurality of file engine resources in the memory, thereby realizing the file preview service loaded on demand. The loading amount of the file engine resources can be reduced in a loading-on-demand mode, so that the response efficiency of file preview is improved, useless file engine resources cannot be loaded in the memory, and the invalid occupation of the memory is reduced.
How to obtain the target file engine resources based on the user preview requirements will be described in detail next.
In one possible implementation, the terminal device may obtain the target file engine resource from the local, S302 includes S3021:
And responding to the local storage of the undetermined file engine resource corresponding to the target file type, and determining the undetermined file engine resource as the target file engine resource.
In some implementation scenarios, the terminal device may store the pending file engine resources corresponding to the target file type locally, for example, the file engine resources corresponding to the file preview engine are stored locally in the terminal device, or the pending file engine resources corresponding to the target file type are obtained from a resource server in the terminal device and have not yet been deleted.
When the file engine resources local to the terminal equipment are all obtained from the resource server, the terminal equipment can firstly attempt to load the local file engine resources when the local file engine resources to be determined corresponding to the preview requirements of the user are provided, so that correct loading can be realized, data interaction required to be obtained from the server can be avoided, and the preview response speed is improved.
In some cases, the file engine resource may undergo a process such as function replacement, optimization update, etc. during use. If the terminal device loads a target file engine resource which is not the latest version, the target file may not be displayed correctly, and even the target file cannot be previewed.
To this end, in one possible implementation, S3021 includes:
S30211: determining target version information of the undetermined file engine resource corresponding to the target file type in response to the undetermined file engine resource locally stored;
S30212: and determining the undetermined file engine resource as the target file engine resource in response to the target version information being the latest version information of the file engine resource corresponding to the target file type.
That is, if the terminal device determines that the pending file engine resource corresponding to the target file type is locally stored, it is required to identify a difference between the target version information of the pending file engine resource and the latest version information of the file engine resource corresponding to the target file type. If the file engine resources to be determined are not different, the file engine resources corresponding to the target file type are not updated in version during the period of storing the file engine resources to the terminal equipment, the file engine resources of the latest version are stored locally, the terminal equipment can determine that the file engine resources are target file engine resources and can load the target file engine resources into a memory, and therefore accuracy of previewing and displaying the target file based on the target file engine resources is improved, and the possibility of incorrect display or incapability of previewing is avoided.
It may also occur that the file engine resource corresponding to the target file type is version-updated during the period of saving the pending file engine resource to the terminal device.
In one possible implementation, the method further comprises:
S11: responding to the fact that the target version information is not the latest version information corresponding to the target file type, and sending a resource acquisition request aiming at the target file type to a resource server;
S12: and acquiring the target file engine resource with version information being the latest version information from the resource server.
That is, when the terminal device determines that the locally stored engine resource of the pending file is not the latest version, in this case, even if the engine resource of the pending file is loaded into the memory, it is possible to erroneously display a part of the content in the target file, and even the preview of the target file cannot be completed. Therefore, the terminal equipment can request to acquire the latest version of target file engine resources from the resource server to load the latest version of target file engine resources in the memory, and preview accuracy is improved.
For example, the target version information is version 1.0, the latest version information is version 2.0, the terminal equipment does not directly load the undetermined file engine resource of version 1.0 in the memory, but acquires the target file engine resource of version 2.0 from the resource server for loading, and the target file engine resource is used as the operation basis of the subsequent preview service.
It should be noted that, in the embodiment of the present application, the resource server may be a cloud server, which is used to save all file engine resources of the file preview engine, and when the file engine resources are updated, the file engine resources are first synchronized to the resource server, so that the file engine resources maintained by the resource server are all in the latest version. Accordingly, the resource server may also record version information of the maintained file engine resources.
The application does not limit how the terminal device obtains the latest version information of the file engine resource corresponding to the target file type by checking the latest version information of the file engine resource corresponding to the target file type, for example, the latest version information can be obtained by updating the file preview engine, and the version information checking is performed locally when the requirement exists, or the latest version information can be obtained by periodically obtaining the latest version information from a resource server storing the file engine resource of the file preview engine, and the version information checking is performed locally when the requirement exists, or the checking can be requested to the resource server when the requirement of the user preview exists, and the checking work is not performed.
In one possible implementation, the method further includes:
s21: transmitting a version verification request to a resource server, wherein the version verification request comprises the target file type and the target version information;
S22: and acquiring a version verification result determined based on the target file type and the target version information from the resource server, wherein the version verification result comprises verification information of whether the target version information is the latest version information.
That is, in this embodiment, the terminal device requests to the resource server to verify the target version information and the latest version information of the file engine resource corresponding to the target file type only when it is determined that the user has a preview requirement. Because the resource server can maintain the file engine resource of the latest version, the returned version check result can accurately indicate the terminal equipment whether the locally stored undetermined file engine resource belongs to the latest version, so that the terminal equipment can respond to the version check result to determine whether to load the locally stored undetermined engine resource into the memory.
The method can efficiently use the transmission resources between the terminal equipment and the resource server, and the occupation of response resources to the resource server can be minimized, thereby greatly improving the interaction efficiency.
It should be noted that the present application is not limited to loading only in the latest version of the terminal device, and in some cases, if the terminal device determines that the target version information can support the correct preview of the target file, the engine resource of the pending file of the target version information may also be loaded into the memory to realize the preview display of the target file. For example, when the version information of the target file is consistent with the version information of the file engine resource, and the file version of the target file is determined to be consistent with the target version information or lower than the target version information, the terminal device can load the undetermined file engine resource as the target file engine resource in the memory, and still can provide normal preview service. Or when the terminal equipment determines that the engine resource of the undetermined file can realize the accurate preview of the target file according to the target version information, the engine resource of the undetermined file can be used as the engine resource of the target file to be loaded in the memory.
Next, how the terminal device obtains the target file engine resource when the terminal device does not locally save the target file engine resource corresponding to the target file type.
In a possible implementation manner, S302 obtains, according to the target file type, a target file engine resource corresponding to the target file type, including:
S3022: responding to the undetermined file engine resource corresponding to the target file type which is not stored locally, and sending a resource acquisition request aiming at the target file type to a resource server;
S3023: and acquiring the target file engine resource with version information being the latest version information from the resource server.
First, S3022 is only a step number labeled for convenience of description, and no limitation is imposed on the execution of S3022 and S3021.
Since the terminal device has no file engine resource capable of previewing the target file locally, the terminal device can request to acquire from the aforementioned resource server based on the target file type. The resource server can synchronize the file engine resources of the latest version in real time, so that the terminal equipment can directly acquire the target file engine resources of the latest version information from the resource server, and the terminal equipment can be used for loading in a memory to preview and display the target file without checking the version information again, thereby improving the preview efficiency.
In the foregoing embodiment, two ways in which the terminal device obtains the target file engine resource from the resource server are described, that is, when the version of the locally stored undetermined file engine resource is not up to date, and when the file engine resource corresponding to the target file type is not stored locally, the target file engine resource corresponding to the target file type needs to be obtained from the resource server.
Before loading the target file engine resource into the memory, the terminal device can further determine the legitimacy of the acquired target file engine resource, so that the risk of loading the illegal file engine resource is avoided. The illegal file engine resource may include, for example, a resource in which a virus such as Trojan is implanted, a tampered resource, or a virus disguised as a resource.
To this end, in one possible implementation, S12 or S3023: the target file engine resource with version information being the latest version information is obtained from the resource server, and the method comprises the following steps:
s31: acquiring engine resources to be checked and check files corresponding to the target file types from the resource server;
s32: generating a corresponding verification signature according to the engine resource to be verified;
S33: and determining the engine resource to be verified as the target file engine resource in response to the verification signature passing the validity verification of the verification file.
When the terminal equipment acquires the engine resource to be checked from the resource server, the terminal equipment also acquires a corresponding check file, wherein the check file can be generated based on the engine resource of the target file and is used for checking the basis of the validity of the engine resource of the target file. The legitimacy may include resource integrity, source legitimacy, and the like.
That is, before the validity check is completed, the terminal device records the file engine resource obtained from the resource server as the engine resource to be checked, and generates a corresponding check signature based on the engine resource to be checked, for example, when the validity check includes the integrity check, the terminal device may perform signature calculation on the first 4096 bytes of data of the engine resource to be checked to obtain the check signature, determine whether the engine resource to be checked is complete or not according to the difference between the integrity signature and the check signature in the check file, that is, whether the engine resource to be checked is consistent with the sending time of the resource server, if the engine resource to be checked is complete, it is determined that the engine resource to be checked is not tampered during the transmission from the resource server to the terminal device through the integrity check, and the terminal device may determine the engine resource to be checked as the target file engine resource.
Therefore, through validity verification, the risk of loading illegal file engine resources can be avoided, and the preview safety is improved.
As described above, when the terminal device locally stores the file engine resource, the corresponding target file version may be determined when the file engine resource is suitable for the user preview requirement. In some scenarios, the file engine resource stored by the terminal device is obtained from the resource server, so in order to make the version information recorded by the terminal device more accurate, the terminal device may record the version information when the file engine resource is obtained from the resource server.
To this end, in one possible implementation, the method further comprises: and updating version information corresponding to the target file type in a locally stored engine resource version information base in response to the acquisition of the target file engine resource.
In this implementation manner, taking the target file engine resource as an example, when the terminal device obtains the target file engine resource from the resource server, the target file engine resource is temporarily stored in the terminal device, that is, may be called in a subsequent file preview process, so that in order to enable the version information of the target file engine resource to be clear when called, the terminal device may update the version information into an engine resource version information library, where the engine resource version information library is used for uniformly maintaining the version information of the file engine resource stored in the terminal device locally. When the terminal equipment subsequently acquires the user preview requirement applicable to the target file engine resource, if the target file engine resource is still locally stored at the moment, version information corresponding to the target file engine resource can be inquired through an engine resource version information base.
Therefore, the terminal equipment can effectively and uniformly maintain version information of the locally stored file engine resources through the engine resource version information base, and accuracy of file preview through the locally stored file engine resources is improved.
The mechanism of how the embodiments of the present application handle concurrent preview requirements is described next.
In one possible implementation, the method further includes:
And adding the target preview task into a task queue, wherein the task queue comprises preview tasks which do not finish file preview.
Correspondingly, S304: and previewing the target file corresponding to the preview task through the loaded target file engine resource, wherein the previewing comprises the following steps:
S3041: reading the target preview task from the task queue after the target file engine resource is loaded in the memory;
s3042: and previewing and displaying the target file corresponding to the preview task through the target file engine resource.
That is, the terminal device may add the target preview task that cannot be immediately processed to the task queue in which the preview task of the file preview is not yet completed is arranged, and then extract the preview task (e.g., the target preview task) from the task queue through a task extraction mechanism (e.g., first-in first-out, etc.) for processing.
When the terminal equipment confirms that the loading of the target file engine resource in the local memory is completed, the condition for processing the target preview task is determined, the target preview task can be extracted from the task queue based on a task extraction mechanism, and the target file corresponding to the target preview task is previewed and displayed through the target file engine resource.
Based on the introduced task queue, the method can buffer the preview tasks through the task queue when the preview tasks are more, avoid preview errors or missing processing, improve the robustness and accuracy of file preview, and effectively support high-concurrency preview scenes.
As described above, the terminal device may save the file engine resource locally, but based on the requirement of saving the local storage resource of the terminal device, the local file engine resource may be deleted at a certain time, but when deleting can avoid excessive re-acquiring the file engine resource from the resource server, so as to improve the utilization efficiency of the file engine resource is a problem to be solved.
In one possible implementation, after the preview display of the target file is finished, the method further includes:
s41: determining the file type of the file to be previewed corresponding to the previewing task in the task queue;
S42: responsive to the file type including the target file type, reserving the target file engine resource in the memory;
s43: and deleting the target file engine resource from the memory in response to the file type not including the target file type.
Since the preview tasks in the task queue are tasks which need to be subjected to preview processing but are not yet subjected to processing, that is, the preview tasks are to be processed, when the terminal equipment determines that the task queue comprises the preview tasks related to the files of the preview target file type, the loaded target file engine resources can be reserved in the memory, and then when the preview tasks are extracted, file preview can be directly realized through the target file engine resources in the memory, and the target file engine resources do not need to be loaded in the memory again, so that the preview response speed is greatly improved. For example, in the embodiment corresponding to S3021, the target file engine resource acquired locally by the terminal device may be reserved in the above manner.
When the preview task in the task queue is determined not to relate to the preview of the file of the target file type, the method is equivalent to the explanation that the target file engine resource is not called temporarily for preview, and the target file engine resource still residing in the memory belongs to the unoccupied memory at the moment, so that the target file engine resource can be deleted from the memory, and the utilization efficiency of the memory resource is improved.
Therefore, the dynamic loading of file engine resources in the memory can be realized based on the file types related to the preview task in the task queue, the utilization efficiency of the local file engine resources of the terminal equipment is improved, and the interaction times with the resource server are reduced.
The file engine resources may include a variety of resource types, such as native so-library, java library, presentation forms of resource files, etc. The file engine resources corresponding to the same file type can relate to file engine resources of multiple resource types, and the file engine resources of different file types can be the same or different. The target file engine resources loaded into the memory by the terminal device each time may involve loading the target file engine resources of different resource types. Even if the same target file engine resource is loaded at different times, the corresponding resource types of the target file engine resource at different times of loading may be different, for example, the target file engine resource of the native so library is loaded for the first time, and the target file engine resource of the Java library is loaded for the second time.
As shown in fig. 4, the file engine resources are illustrated from two dimensions. The left side shows that the file engine resource may correspond to different file types, for example, for previewing PDF files, may be denoted as PDF type resource, previewing word files, may be denoted as word type resource, previewing txt files, may be denoted as txt type resource.
Three possible resource types of the file engine resource are shown on the left side, for example, a native so library, a Java library, or a resource file, it should be noted that, in fig. 4, only an example is shown, and the resource types of the file engine resource are not limited to three types, but may be other resource types.
In addition, when the file engine resource is uniformly maintained through the resource server, the file engine resource can also be provided with a corresponding check file, and the corresponding check file can be sent to the terminal equipment together when the terminal equipment requests to acquire the file engine resource, so that the terminal equipment performs validity check on the received undetermined engine resource based on the check file.
Since the loading mechanisms of the target file engine resources of different resource types may differ, in one possible implementation, S303: loading the target file engine resource in the memory, including:
s3031: determining the resource type of the target file engine resource;
s3032: determining a target loading mode corresponding to the resource type from a plurality of loading modes;
S3033: and loading the target file engine resource in the memory through the target loading mode.
Before loading, determining the resource type of the target file engine resource, so that the terminal equipment can load the target file engine resource in the memory by using a correct loading mode corresponding to the resource type, the situation that the target file engine resource is loaded by using an incorrect mode is avoided, and the loading precision and efficiency of the target file engine resource are improved.
Next, a processing manner of the terminal device after acquiring the target file engine resource will be described with reference to fig. 5 and 6. Fig. 5 shows a scenario in which the terminal device and the server cooperate to complete the preview display of the file, and a modularized exploded description is made based on the function.
The resource server provides file engine resource service in this scenario, and for the terminal device, the installation of the file preview engine is performed through the client SDK, and the file preview engine includes three functional modules, namely a file preview engine core API, file engine resource version management and a dynamic loader.
The file engine resource service is used for managing the version of the file engine resource and issuing the file engine resource to the terminal equipment. The file preview engine core API is used for providing a corresponding file preview interface for file preview. The file engine resource management is used for communicating with the resource server and managing the version of the local file engine resource. The dynamic loader is used for realizing the dynamic loading of the file engine resources in the memory.
After the terminal equipment obtains the target file engine resource from the resource server, the steps of checking, pre-editing, linking, loading, executing and the like are executed based on the three functional modules.
1. And (3) checking: the dynamic loader firstly decompresses the acquired file engine resources (in the case of transmission after the file engine resources are compressed) before the file engine resources are loaded into the memory; the method comprises the steps that a file engine resource and a corresponding check file can be obtained through decompression, SHA signature information A1 is contained in the file engine resource, signature A2 obtained through SHA calculation is carried out on first 4096 bytes of data of the file engine resource, AI and A2 are compared, if A1=A2, check is successful, it is determined that the file engine resource is complete, and the file engine resource can be loaded; otherwise, the verification fails, and the file engine resource is not loaded.
2. Precompilation: after the verification is successful, determining the resource type of the file engine resource, if the file engine resource is a java library, executing a precompiled operation on the java library file by the terminal equipment through calling a dex2oat method, and storing the precompiled operation in an application installation directory, wherein the precompiled operation can generate the oat file. If the file is a native so library or resource file, the file is copied to an external storage directory of the application and stored in sdcard.
3. Linking: there are two cases of linking, one is to establish a soft link by establishing a soft link to a resource file stored in an external storage directory through a content provider (ContentProvider), so that a file preview engine can directly access a file engine resource of the external storage directory through the ContentProvider. Another case is that for a native so file, since the so file has a case of depending on the so information thereof, when the so file is loaded, if the depending so information is not preloaded, abnormal operation is caused; in view of this, in the embodiment of the present application, a run time. Exec is executed by script to execute a command 'readelf-d', the execution result of the command is obtained, the dependent item of the so file is extracted by a keyword (SharedLibrary), other so information on which the so file depends is obtained, and the other dependent so information is cached.
4. Loading: the loading process is divided into different cases based on resource types, and in the embodiment of the application, the loading process is mainly described based on the three resource types:
a. For the java library file, for the loading of the java library file, the terminal device can construct a ClassLoader, and then load the oat file generated by precompiled from the application installation directory by utilizing the constructed ClassLoader.
B. For the so file, the terminal device uses the same ClassLoader as in a, and according to other cached so information in the step 3, obtains mNativeLib objects (arrays) of the ClassLoader in a reflection mode, and adds a path of the so file to the forefront of mNativeLib objects.
C. For resource files (pictures etc.), since global soft links are already established by ContentProvider during the linking process, the terminal device can directly access via the schema protocol provided by ContentProvider.
Next, a file preview scheme according to an embodiment of the present application will be described with reference to fig. 7.
Step 1: core engine APIs are called
The user attempts to open the target file using the openFile interface provided by the engine core API of the file preview engine, thereby generating a preview task.
Step 2: cache preview tasks
The engine core API module may encapsulate openFile interface parameters, caching preview tasks for previewing the target file into a task queue.
Step 3: obtaining a target file type
The terminal device may obtain the target file type of the target file to be opened currently from the parameters openFile, and obtain the corresponding target file engine resource according to the target file type. The corresponding relation is that if the file is the pdf type file, the file engine resource for realizing the previewing of the pdf type file needs to be loaded; the file engine resources corresponding to other file types may be analogized.
Step4: obtaining target version information
Step 5: judging whether the corresponding file engine resource exists locally
After extracting the target file TYPE (TYPE-A) from the openFile parameters in the previous step 3, inquiring whether the corresponding target file engine resource and the corresponding target version information exist locally or not through the file engine resource version management module. If not, jump to step 8, if yes, go to step 6
Step 6: comparing with the latest version information
Judging whether the target file engine resource of the current target file TYPE (TYPE-A) is the latest or not by communicating with the file preview engine resource service in the resource server by utilizing the acquired target version information; if it is the latest version of the file engine resource, then the target file engine resource is attempted to be loaded (step 8), otherwise the target file engine resource is attempted to be obtained from the resource server (step 7).
Step 7: acquiring target file engine resources
Downloading the target file engine resource from the resource server on line according to the target file TYPE (TYPE-A), and updating the version information of the target file engine resource to a local engine resource version information base if the downloading is successful.
Step 8: loading target file engine resources
Decompressing the downloaded or local target file engine resource and executing dynamic loading according to the resource type in the target file engine resource.
Step 9: reading preview task execution previews
And after the dynamic loading of the target file engine resource is completed, reading the target preview task cached in the task queue, and executing the target preview task to open the corresponding target file.
Step 10: callback notification
After the file opening task is completed, notifying a calling initiator of the file opening task, and file preview success information.
After the target preview task is completed, the target file engine resource loaded in the task enters a recovery stage, and if the preview task of the target file type is not related in the current task queue, the target file engine resource is directly recovered; otherwise, the target file engine resource dynamically loaded in the memory is kept reserved.
On the basis of the foregoing embodiments corresponding to fig. 2 to fig. 7, fig. 8 is a device structure diagram of a file previewing device according to an embodiment of the present application, where the file previewing device 800 includes an obtaining unit 801, a loading unit 802, and a previewing unit 803:
The acquiring unit 801 is configured to acquire a target preview task for a target file through a file preview interface, where the target preview task includes a target file type of the target file;
The obtaining unit 801 is further configured to obtain, according to the target file type, a target file engine resource corresponding to the target file type;
the loading unit 802 is configured to load the target file engine resource in a memory;
and the preview unit 803 is configured to preview the target file corresponding to the target preview task by using the loaded target file engine resource.
In one possible implementation manner, the obtaining unit is further configured to determine, in response to locally storing a pending file engine resource corresponding to the target file type, the pending file engine resource as the target file engine resource.
In a possible implementation manner, the obtaining unit is further configured to:
determining target version information of the undetermined file engine resource corresponding to the target file type in response to the undetermined file engine resource locally stored;
And determining the undetermined file engine resource as the target file engine resource in response to the target version information being the latest version information of the file engine resource corresponding to the target file type.
In a possible implementation manner, the apparatus further includes a sending unit:
The sending unit is used for responding to the fact that the target version information is not the latest version information corresponding to the target file type and sending a resource acquisition request aiming at the target file type to a resource server;
The obtaining unit is further configured to obtain, from the resource server, the target file engine resource whose version information is the latest version information.
In a possible implementation manner, the apparatus further includes a sending unit:
the sending unit is used for sending a version verification request to a resource server, wherein the version verification request comprises the target file type and the target version information;
the acquisition unit is further configured to acquire, from the resource server, a version verification result determined based on the target file type and the target version information, where the version verification result includes verification information of whether the target version information is the latest version information.
In a possible implementation manner, the obtaining unit is further configured to:
Responding to the undetermined file engine resource corresponding to the target file type which is not stored locally, and sending a resource acquisition request aiming at the target file type to a resource server;
and acquiring the target file engine resource with version information being the latest version information from the resource server.
In one possible implementation, the apparatus further includes an enqueuing unit:
the enqueuing unit is used for adding the target preview task into a task queue, wherein the task queue comprises preview tasks which do not finish file preview yet;
The preview unit is further configured to:
Reading the target preview task from the task queue after the target file engine resource is loaded in the memory;
and previewing and displaying the target file corresponding to the preview task through the target file engine resource.
In a possible implementation manner, the apparatus further includes a determining unit:
the determining unit is further configured to:
after the preview display of the target file is finished, determining the file type of the file to be previewed corresponding to the preview task in the task queue;
Responsive to the file type including the target file type, reserving the target file engine resource in the memory;
and deleting the target file engine resource from the memory in response to the file type not including the target file type.
In a possible implementation manner, the obtaining unit is further configured to:
acquiring engine resources to be checked and check files corresponding to the target file types from the resource server;
Generating a corresponding verification signature according to the engine resource to be verified;
and determining the engine resource to be verified as the target file engine resource in response to the verification signature passing the validity verification of the verification file.
In a possible implementation, the loading unit is further configured to:
determining the resource type of the target file engine resource;
determining a target loading mode corresponding to the resource type from a plurality of loading modes;
And loading the target file engine resource in the memory through the target loading mode.
In one possible implementation manner, the device further includes an updating unit, where the updating unit is configured to update version information corresponding to the target file type in a locally stored engine resource version information library in response to acquiring the target file engine resource.
Therefore, when the preview service is provided, the target preview task for the target file is acquired through the file preview interface, the corresponding target file engine resource is acquired according to the target file type of the target file, and is loaded in the memory, and the target file corresponding to the target preview task can be previewed and displayed through the loaded target file engine resource. Because the target file engine resource is one of a plurality of file engine resources for previewing different file types, namely when the preview requirement is determined to be the target file type, the service meeting the preview requirement can be provided by only loading the engine resource aiming at the target file type into the memory without loading all the plurality of file engine resources in the memory, thereby realizing the file preview service loaded on demand. The loading amount of the file engine resources can be reduced in a loading-on-demand mode, so that the response efficiency of file preview is improved, useless file engine resources cannot be loaded in the memory, and the invalid occupation of the memory is reduced.
The embodiment of the application also provides a computer device, which is the computer device introduced above, and can comprise a terminal device or a server, and the file previewing device can be configured in the computer device. The computer device is described below with reference to the accompanying drawings.
If the computer device is a terminal device, please refer to fig. 9, an embodiment of the present application provides a terminal device, taking the terminal device as a mobile phone as an example:
Fig. 9 is a block diagram showing a part of the structure of a mobile phone related to a terminal device provided by an embodiment of the present application. Referring to fig. 9, the mobile phone includes: radio Frequency (RF) circuitry 1410, memory 1420, input unit 1430, display unit 1440, sensor 1450, audio circuitry 1460, wireless fidelity (WiFi) module 1470, processor 1480, and power supply 1490. It will be appreciated by those skilled in the art that the handset construction shown in fig. 9 is not limiting of the handset and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The following describes the components of the mobile phone in detail with reference to fig. 9:
the RF circuit 1410 may be used for receiving and transmitting signals during a message or a call, and particularly, after receiving downlink information of a base station, the downlink information is processed by the processor 1480; in addition, the data of the design uplink is sent to the base station.
The memory 1420 may be used to store software programs and modules, and the processor 1480 performs various functional applications and data processing of the cellular phone by executing the software programs and modules stored in the memory 1420. The memory 1420 may mainly include a storage program area that may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), and a storage data area; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, memory 1420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The input unit 1430 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the handset. In particular, the input unit 1430 may include a touch panel 1431 and other input devices 1432.
The display unit 1440 may be used to display information input by a user or information provided to the user and various menus of the mobile phone. The display unit 1440 may include a display panel 1441.
The handset can also include at least one sensor 1450, such as a light sensor, motion sensor, and other sensors.
Audio circuitry 1460, speaker 1461, microphone 1462 may provide an audio interface between the user and the handset.
WiFi belongs to a short-distance wireless transmission technology, and a mobile phone can help a user to send and receive emails, browse webpages, access streaming media and the like through a WiFi module 1470, so that wireless broadband Internet access is provided for the user.
The processor 1480 is a control center of the handset, connects various parts of the entire handset using various interfaces and lines, performs various functions of the handset and processes data by running or executing software programs and/or modules stored in the memory 1420, and invoking data stored in the memory 1420.
The handset also includes a power supply 1490 (e.g., a battery) that provides power to the various components.
In this embodiment, the processor 1480 included in the terminal apparatus also has the following functions:
acquiring a target preview task aiming at a target file through a file preview interface, wherein the target preview task comprises a target file type of the target file;
acquiring a target file engine resource corresponding to the target file type according to the target file type;
loading the target file engine resource in a memory;
And previewing and displaying the target file corresponding to the target preview task through the loaded target file engine resource.
If the computer device is a server, as shown in fig. 10, fig. 10 is a block diagram of a server 1500 according to an embodiment of the present application, where the server 1500 may have a relatively large difference due to different configurations or performances, and may include one or more central processing units (Central Processing Units, abbreviated as CPU) 1522 (e.g., one or more processors) and a memory 1532, one or more storage media 1530 (e.g., one or more mass storage devices) storing application programs 1542 or data 1544. Wherein the memory 1532 and the storage medium 1530 may be transitory or persistent storage. The program stored on the storage medium 1530 may include one or more modules (not shown), each of which may include a series of instruction operations on the server. Still further, the central processor 1522 may be configured to communicate with a storage medium 1530 and execute a series of instruction operations on the storage medium 1530 on the server 1500.
The Server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input/output interfaces 1558, and/or one or more operating systems 1541, such as a Windows Server TM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM, and the like.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 10.
In addition, the embodiment of the application also provides a storage medium for storing a computer program for executing the method provided by the embodiment.
The embodiments of the present application also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method provided by the above embodiments.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, where the above program may be stored in a computer readable storage medium, and when the program is executed, the program performs steps including the above method embodiments; and the aforementioned storage medium may be at least one of the following media: read-only Memory (ROM), RAM, magnetic disk or optical disk, etc.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment is mainly described in a different point from other embodiments. In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, with reference to the description of the method embodiments in part. The apparatus and system embodiments described above are merely illustrative, in which elements illustrated as separate elements may or may not be physically separate, and elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the technical scope of the present application should be included in the scope of the present application. Further combinations of the present application may be made to provide further implementations based on the implementations provided in the above aspects. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (15)

1. A method for previewing a file, the method comprising:
acquiring a target preview task aiming at a target file through a file preview interface, wherein the target preview task comprises a target file type of the target file;
acquiring a target file engine resource corresponding to the target file type according to the target file type;
loading the target file engine resource in a memory;
And previewing and displaying the target file corresponding to the target preview task through the loaded target file engine resource.
2. The method according to claim 1, wherein the obtaining, according to the target file type, a target file engine resource corresponding to the target file type includes:
And responding to the local storage of the undetermined file engine resource corresponding to the target file type, and determining the undetermined file engine resource as the target file engine resource.
3. The method of claim 2, wherein the determining the pending file engine resource as the target file engine resource in response to locally storing the pending file engine resource corresponding to the target file type comprises:
determining target version information of the undetermined file engine resource corresponding to the target file type in response to the undetermined file engine resource locally stored;
And determining the undetermined file engine resource as the target file engine resource in response to the target version information being the latest version information of the file engine resource corresponding to the target file type.
4. A method according to claim 3, characterized in that the method further comprises:
Responding to the fact that the target version information is not the latest version information corresponding to the target file type, and sending a resource acquisition request aiming at the target file type to a resource server;
and acquiring the target file engine resource with version information being the latest version information from the resource server.
5. A method according to claim 3, characterized in that the method further comprises:
Transmitting a version verification request to a resource server, wherein the version verification request comprises the target file type and the target version information;
And acquiring a version verification result determined based on the target file type and the target version information from the resource server, wherein the version verification result comprises verification information of whether the target version information is the latest version information.
6. The method according to claim 1, wherein the obtaining, according to the target file type, a target file engine resource corresponding to the target file type includes:
Responding to the undetermined file engine resource corresponding to the target file type which is not stored locally, and sending a resource acquisition request aiming at the target file type to a resource server;
and acquiring the target file engine resource with version information being the latest version information from the resource server.
7. The method according to claim 1, wherein the method further comprises:
adding the target preview task into a task queue, wherein the task queue comprises preview tasks which do not finish file preview yet;
The target file engine resource which is completed through loading previews the target file corresponding to the preview task, and the method comprises the following steps:
Reading the target preview task from the task queue after the target file engine resource is loaded in the memory;
and previewing and displaying the target file corresponding to the preview task through the target file engine resource.
8. The method of claim 7, wherein after the preview display of the target file is completed, the method further comprises:
Determining the file type of the file to be previewed corresponding to the previewing task in the task queue;
Responsive to the file type including the target file type, reserving the target file engine resource in the memory;
and deleting the target file engine resource from the memory in response to the file type not including the target file type.
9. The method according to claim 4 or 6, wherein the obtaining the target file engine resource whose version information is the latest version information from the resource server includes:
acquiring engine resources to be checked and check files corresponding to the target file types from the resource server;
Generating a corresponding verification signature according to the engine resource to be verified;
and determining the engine resource to be verified as the target file engine resource in response to the verification signature passing the validity verification of the verification file.
10. The method of claim 1, wherein loading the target file engine resource in memory comprises:
determining the resource type of the target file engine resource;
determining a target loading mode corresponding to the resource type from a plurality of loading modes;
And loading the target file engine resource in the memory through the target loading mode.
11. A method according to claim 4 or 6, characterized in that the method further comprises:
And updating version information corresponding to the target file type in a locally stored engine resource version information base in response to the acquisition of the target file engine resource.
12. A file previewing device, characterized in that the device comprises an acquisition unit, a loading unit and a previewing unit:
The acquisition unit is used for acquiring a target preview task aiming at a target file through a file preview interface, wherein the target preview task comprises a target file type of the target file;
the acquisition unit is also used for acquiring target file engine resources corresponding to the target file type according to the target file type;
the loading unit is used for loading the target file engine resource in the memory;
And the preview unit is used for previewing and displaying the target file corresponding to the target preview task through the loaded target file engine resource.
13. A computer device, the computer device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
The processor is configured to perform the method of any of claims 1-11 according to instructions in the program code.
14. A computer readable storage medium, characterized in that the computer readable storage medium is for storing a computer program for executing the method of any one of claims 1-11.
15. A computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any of claims 1-11.
CN202211372498.5A 2022-11-03 2022-11-03 File previewing method and related device Pending CN118034895A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211372498.5A CN118034895A (en) 2022-11-03 2022-11-03 File previewing method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211372498.5A CN118034895A (en) 2022-11-03 2022-11-03 File previewing method and related device

Publications (1)

Publication Number Publication Date
CN118034895A true CN118034895A (en) 2024-05-14

Family

ID=90988143

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211372498.5A Pending CN118034895A (en) 2022-11-03 2022-11-03 File previewing method and related device

Country Status (1)

Country Link
CN (1) CN118034895A (en)

Similar Documents

Publication Publication Date Title
CN107122379B (en) Collecting transaction data associated with a locally stored data file
US9792623B2 (en) Advertisement processing method and apparatus
US12014170B2 (en) Mini program batch processing method and apparatus, electronic device, and readable storage medium
EP4270299A1 (en) Operating system upgrade method, electronic device, and storage medium
WO2022000869A1 (en) Batch processing method and apparatus for mini programs, and electronic device and readable storage medium
CN113302585B (en) Acceleration application and sub-package installation
CN113590169B (en) Application deployment method, application deployment system, and computer-readable storage medium
CN111240766A (en) Application starting method and device, electronic equipment and computer readable storage medium
CN113961520A (en) Dynamic file mounting method, system, computer equipment and readable storage medium
CN110765394A (en) So file loading method and device, storage medium and terminal equipment
US10938773B2 (en) Method and apparatus for synchronizing contact information and medium
CN115150392B (en) Remote file copying method, system, computing equipment and storage medium
US7784048B2 (en) Mobile communication terminal and application control method
CN110574006B (en) System and method for automatically synchronizing responses and conditions on a device
CN112883006B (en) Enterprise-level container mirror image acceleration method and device, electronic equipment and storage medium
CN114780615A (en) Error code management method and device thereof
CN115878138B (en) Application pre-download method, device, computer and storage medium
CN118034895A (en) File previewing method and related device
CN114270309A (en) Resource acquisition method and device and electronic equipment
CN113094211B (en) Backup data processing method and device
CN114115941A (en) Resource sending method, page rendering method, device, electronic equipment and medium
CN113515299A (en) Software development kit SDK hot upgrading method, device, equipment and storage medium
CN114077587A (en) Rule engine based business processing method, rule engine, medium and device
CN110659309A (en) Memory database communication method, device, server and storage medium
US20240378042A1 (en) Operating System Update Method, Electronic Device, and Storage Medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication