CN108363747A - Assets files in batch copy methods - Google Patents

Assets files in batch copy methods Download PDF

Info

Publication number
CN108363747A
CN108363747A CN201810077278.7A CN201810077278A CN108363747A CN 108363747 A CN108363747 A CN 108363747A CN 201810077278 A CN201810077278 A CN 201810077278A CN 108363747 A CN108363747 A CN 108363747A
Authority
CN
China
Prior art keywords
files
assets
assetsmanager
file
path
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
CN201810077278.7A
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.)
Xiamen Yealink Network Technology Co Ltd
Original Assignee
Xiamen Yealink Network 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 Xiamen Yealink Network Technology Co Ltd filed Critical Xiamen Yealink Network Technology Co Ltd
Priority to CN201810077278.7A priority Critical patent/CN108363747A/en
Publication of CN108363747A publication Critical patent/CN108363747A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • 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

Landscapes

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

Abstract

The present invention relates to a kind of Assets files in batch copy methods, it passes through the path of file under the pre-configured Assets catalogues of resource.xml configuration files, and read resource.xml files using AssetsManager.open interfaces, the path of file destination is obtained, then AssetsManager.open interfaces is called to read file destination.Compared with prior art, batch copy method of the invention substantially increases the speed of batch copy.

Description

Assets files in batch copy methods
Technical field
The present invention relates to Android applied technical fields, and in particular to a kind of Assets files in batch copy method.
Background technology
Assets puts the catalogue of resource file for Android application memories.AssetsManager is in Android One resource management class that can operate Assets catalogues, it contains the interfaces such as list and open, and list interfaces can obtain Folder path under Assets catalogues, open interfaces can open the file specified under Assets catalogues.Sdcard is Android phone stored memory card.
As shown in Figure 1, needing to copy the All Files under assets/config catalogues under sdcard to, existing solution Certainly scheme is All Files folder and the text traversed by AssetsManager.list (" config ") interface under config catalogues Part calls AssetsManager.open to read file and is copied if get is file to traversal;If got It is file, then then needing that list interfaces is called to carry out traversal acquisition again, needs to call AssetsManager.list (" config/data ") and AssetsManager.list (" config/resource "), if there is folder hierarchy The numbers for calling list much more.
Currently existing scheme traverses file by calling AssetsManager.list interfaces, and interface calling compares It takes, averagely takes at 20 milliseconds ~ 200 milliseconds, had differences according to loom performance difference.So existing scheme there are the shortcomings that Be exactly if there is folder hierarchy it is more in the case of, need repeatedly to call AssetsManager.list interfaces, cause non- It often takes, even ANR, ANR can occur for improper use(Application Not Responding)Refer to application program without Response, if cannot respond user operation case in Android applications 5s will occur ANR.
Invention content
The purpose of the present invention is to provide a kind of Assets files in batch copy methods, can improve Android applications Copy the speed of sdcard to from Assets files in batch.
To achieve the above object, the technical solution adopted by the present invention is:
A kind of Assets files in batch copy method comprising following steps:
Step 1 creates resouces.xml configuration files under Assets catalogues, and the content of this document is under Assets catalogues File path configuration, partial content is as shown in Figure 3;
Step 2 calls AssetsManager.open (" resources.xml ") to read resource.xml configuration files, and Resources.xml files are parsed, the file path under Assets catalogues, i.e. file destination path are obtained;
Step 3, according to the file destination path obtained in step 2, call AssetsManager.open to read file destination, and File destination is copied in sdcard.
After adopting the above scheme, the present invention by the pre-configured Assets catalogues of resource.xml configuration files hereafter The path of part, and resource.xml files are read using AssetsManager.open interfaces, the path of file destination is obtained, Then AssetsManager.open interfaces are called to read file destination.Under identical file and quantity of documents, existing skill The copy method of art averagely takes in second grade level, reaches on the type of part tens seconds, and uses the method for the present invention in phase Reach Millisecond under same type, substantially increases the speed of batch copy.Moreover, the batch copy method of the present invention only needs Safeguard resources.xml configuration files, and automatic script can be used to generate for this document, maintenance cost is low.
Description of the drawings
Fig. 1 is Assets catalogues schematic diagram of the present invention;
Fig. 2 is flow chart of the present invention;
Fig. 3 is the content schematic diagram of resources.xml files of the present invention.
Specific embodiment
As shown in Fig. 2, present invention is disclosed a kind of Assets files in batch copy method, it is specific as follows:
Step 1 creates resouces.xml configuration files under Assets catalogues, and the content of this document is under Assets catalogues File path configuration, partial content is as shown in Figure 3;
Step 2 calls AssetsManager.open (" resources.xml ") to read resource.xml configuration files, and Resources.xml files are parsed, the file path under Assets catalogues, i.e. file destination path are obtained;
Step 3, according to the file destination path obtained in step 2, call AssetsManager.open to read file destination, and File destination is copied in sdcard.
The present invention it is critical that the present invention passes through under the pre-configured Assets catalogues of resource.xml configuration files The path of file obtains file destination path without using AssetsManager.list interfaces, but uses AssetsManager.open interfaces read resource.xml files, obtain the path of file destination, then directly invoke AssetsManager.open interfaces read file destination.Under identical file and quantity of documents, the copy of the prior art Method averagely takes in second grade level, reaches on the type of part tens seconds, and uses the method for the present invention in identical type Under reached Millisecond, substantially increase batch copy speed.Moreover, the batch copy method of the present invention only needs to safeguard Resources.xml configuration files, and automatic script can be used to generate for this document, maintenance cost is low.
The above is only the embodiment of the present invention, is not intended to limit the scope of the present invention, therefore every According to the technical essence of the invention to any subtle modifications, equivalent variations and modifications made by above example, this is still fallen within In the range of inventive technique scheme.

Claims (1)

1. a kind of Assets files in batch copy method, it is characterised in that:The batch copy method includes the following steps:
Step 1 creates resouces.xml configuration files under Assets catalogues, and the content of this document is under Assets catalogues File path configuration;
Step 2 calls AssetsManager.open (" resources.xml ") to read resource.xml configuration files, and Resources.xml files are parsed, the file path under Assets catalogues, i.e. file destination path are obtained;
Step 3, according to the file destination path obtained in step 2, call AssetsManager.open to read file destination, and File destination is copied in sdcard.
CN201810077278.7A 2018-01-26 2018-01-26 Assets files in batch copy methods Pending CN108363747A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810077278.7A CN108363747A (en) 2018-01-26 2018-01-26 Assets files in batch copy methods

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810077278.7A CN108363747A (en) 2018-01-26 2018-01-26 Assets files in batch copy methods

Publications (1)

Publication Number Publication Date
CN108363747A true CN108363747A (en) 2018-08-03

Family

ID=63007251

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810077278.7A Pending CN108363747A (en) 2018-01-26 2018-01-26 Assets files in batch copy methods

Country Status (1)

Country Link
CN (1) CN108363747A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109901910A (en) * 2019-01-17 2019-06-18 珠海金山网络游戏科技有限公司 File based on distributed container pulls or method for pushing and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
PT106012A (en) * 2011-11-07 2013-05-07 Univ Da Beira Interior GEOGRAPHICAL REFERRAL METHOD FOR VEHICLE NETWORKS WITH INTERMITTENT CONNECTIONS
CN104965723A (en) * 2014-10-09 2015-10-07 腾讯科技(深圳)有限公司 Application program operation method and apparatus
CN105184118A (en) * 2015-08-31 2015-12-23 西北大学 Code fragmentization based Android application program packing protection method and apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
PT106012A (en) * 2011-11-07 2013-05-07 Univ Da Beira Interior GEOGRAPHICAL REFERRAL METHOD FOR VEHICLE NETWORKS WITH INTERMITTENT CONNECTIONS
CN104965723A (en) * 2014-10-09 2015-10-07 腾讯科技(深圳)有限公司 Application program operation method and apparatus
CN105184118A (en) * 2015-08-31 2015-12-23 西北大学 Code fragmentization based Android application program packing protection method and apparatus

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
匿名用户: "How to get an amount of the files in certain folder in assects", 《HTTPS://STACKOVERFLOW.COM/QUESTIONS/8030272/HOW-TO-GET-AN-AMOUNT-OF-THE-FILES-IN-CERTAIN-FOLDER-IN-ASSETS》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109901910A (en) * 2019-01-17 2019-06-18 珠海金山网络游戏科技有限公司 File based on distributed container pulls or method for pushing and device
CN109901910B (en) * 2019-01-17 2021-12-07 珠海金山网络游戏科技有限公司 File pulling or pushing method and device based on distributed container

Similar Documents

Publication Publication Date Title
CN109002362B (en) Service method, device and system and electronic equipment
KR102220127B1 (en) Method and apparatus for customized software development kit (sdk) generation
US5778228A (en) Method and system for transferring remote procedure calls and responses over a network
US8516037B2 (en) Methods for dynamic partitioning of applications in client-server environments
US11860879B2 (en) On-demand execution of object transformation code in output path of object storage service
US10908927B1 (en) On-demand execution of object filter code in output path of object storage service
CN104484216A (en) Method and device for generating service interface document and on-line test tool
CN103927314B (en) A kind of method and apparatus of batch data processing
US10397051B1 (en) Configuration and testing of network-based service platform resources using a service platform specific language
EP4035002A1 (en) On-demand execution of object filter code in output path of object storage service
US11250007B1 (en) On-demand execution of object combination code in output path of object storage service
US20210096883A1 (en) Inserting executions of owner-specified code into input/output path of object storage service
US11416314B2 (en) Adaptive application version integration support
CN103064738A (en) Method and system for embedding local application program window into browser in Linux
CN110716720A (en) Method and device for realizing application hot deployment
CN114586011A (en) Insertion of owner-specified data processing pipelines into input/output paths of object storage services
CN104063303B (en) A method of obtaining and discharge root authority
CN112463290A (en) Method, system, apparatus and storage medium for dynamically adjusting the number of computing containers
CN113010332A (en) Remote service calling method, device, equipment and storage medium
CN108363747A (en) Assets files in batch copy methods
CN101340688B (en) Configuration script configuring method based on strip operation tag in network management system
WO2021254214A1 (en) Migration method and apparatus for android application program
Glaser et al. Model Driven Cloud Orchestration by Combining TOSCA and OCCI.
CN110045950A (en) Static page based on nodejs develops scaffold method
CN108153745B (en) Application data calling method and application development system

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20180803