The content of the invention
In view of this, it is an object of the present invention to provide a kind of method and device realized file scan and preserved.For
There is a basic understanding to some aspects of the embodiment of disclosure, shown below is simple summary.The summarized section is not
It is extensive overview, nor to determine key/critical component or describe the protection domain of these embodiments.Its sole purpose
It is that some concepts are presented with simple form, in this, as the preamble of following detailed description.
It is an object of the present invention to provide a kind of method realized file scan and preserved, including:
Carry storage device, and it is scanned to the storage device;
Obtain the universal unique identifier UUID of the storage device;
Determine whether subdata base corresponding with the UUID;If so, then open son corresponding with the storage device
Database and public database;
The validity of record in checking subdata base corresponding with current storage devices;
Each file in the storage device is traveled through, obtains the information of each file in the storage device;
After having traveled through, all records on the storage device in the subdata base are inquired about, then will inquired
Record is inserted in the public database.
In some optional embodiments, in addition to:
If judging subdata base not corresponding with the UUID, the quantity of existing subdata base is first checked;
When the quantity of existing subdata base is more than or equal to specified quantity, then untapped subdata base recently is carried out
Delete, then create subdata base corresponding with the storage device and preserve, then open the subdata base and public database;
When the quantity of existing subdata base is less than specified quantity, then subnumber corresponding with the storage device is directly created
According to storehouse and preserve, then open the subdata base and public database.
In some optional embodiments, the subdata base, the text for one corresponding storage device of duplicated record
Part information;A subdata base in file system correspondence system in each storage device;The subdata base is only by this
System is operated and controlled;
The public database, the fileinfo of the storage device for recording current all carries, is additionally operable to for other
Application program accesses and operation.
It is described after carry storage device in some optional embodiments, in addition to:
System sends carry broadcast;
After scanner receives the carry broadcast, the storage device is scanned.
In some optional embodiments, the validity of the record in the checking current sub-data storehouse, is according to inquiry
The attribute of all records in subdata base is verified;
The attribute comprises at least:The deposit position of file and the last modification time of file.
In some optional embodiments, in addition to:
If the file corresponding to the deposit position attribute of file is present, and the last modification time of the file does not become
Change, illustrate there is this document really in the storage device, then it represents that the record is effective.
In some optional embodiments, in addition to:
If the file corresponding to the deposit position attribute of file is not present, there is no this article in storage device belonging to explanation
Part, then it represents that the protocol failure, now by the record deletion, continue checking for next record.
In some optional embodiments, in addition to:
If the file corresponding to the deposit position attribute of file is present, but the last modification time of the file has change
Change, then delete the record, scanning to be preserved again to the information of this document after waiting, continue checking for next note
Record.
In some optional embodiments, each file in the traversal storage device, obtain the storage and set
The information of each file in standby, is specifically included:
When traversal obtains a file, check in the subdata base whether be related to the record of this document, if not having, obtain
This document information is taken, and the fileinfo got is preserved into the subdata base, traversal is then proceeded to and is completed until traveling through,
If so, then continue to travel through next file.
In some optional embodiments, in addition to:
When scanning completion, other programs are notified.
In some optional embodiments, if the multiple storage devices of carry simultaneously, system sends carry broadcast, scanner
It can start to perform scanning by carry order to each storage device according to the carry broadcast received;And for each storage
Equipment corresponds to create one and its No. UUID corresponding subdata base respectively, and stores.
In some optional embodiments, when removing or unloading the storage device, system sends removal or unloading is wide
Broadcast, multimedia content provider can delete all about institute in the public database according to the removal or unloading broadcast received
The record of the storage device is stated, and closes subdata base corresponding with the storage device.
In some optional embodiments, if removing or unloading simultaneously multiple storage devices, system sends removal or unloaded
The broadcast of load, the multimedia content provider can start suitable by removing or unloading according to the removal or the broadcast of unloading received
Sequence delete in the public database it is all about it is each be removed or the record of the storage device of unloading, and close with it is each
Subdata base corresponding to the storage device for being removed or unloading.
In some optional embodiments, when storage device described in carry again, system sends carry broadcast;Scanner
After the carry broadcast received, it is only necessary to subdata base corresponding with the storage device is opened, to the information in the subdata base
It is updated, then the record in the subdata base is entirely insertable into the public database, for other application program apk
Access.
It is a further object of the invention to provide a kind of device realized file scan and preserved, including:
Scan module, for being scanned to the storage device of carry, and obtain general unique mark of the storage device
Know symbol UUID;
Discrimination module, for judging whether there is subdata base corresponding with the UUID in system;If so, then open and institute
State subdata base corresponding to storage device and public database;
Authentication module, for verifying the validity of the record in subdata base corresponding with current storage devices;
Spider module, for traveling through each file in the storage device;
File information block is obtained, for obtaining the information of each file in the storage device;With,
Enquiry module, for inquiring about all records in the subdata base on the storage device, then it will inquire
Record insert in the public database.
In some optional embodiments, in addition to creation module;
The discrimination module, if judging subdata base not corresponding with the UUID, first check existing subdata base
Quantity;When the quantity of existing subdata base is more than or equal to specified quantity, then untapped subdata base recently is carried out
Delete, then notify creation module;When the quantity of existing subdata base is less than specified quantity, then creation module is directly notified;
The creation module, for creating subdata base corresponding with the storage device, and preserve;
The discrimination module, then open subdata base and public database that the creation module creates.
In some optional embodiments, the subdata base, the text for one corresponding storage device of duplicated record
Part information, the subdata base in file system correspondence system in each storage device;The subdata base is only by this dress
The system put is operated and controlled;
The public database, the fileinfo of the storage device for recording current all carries, is additionally operable to for other
Application program accesses and operation.
The authentication module, it is according to the category for inquiring about all records in subdata base in some optional embodiments
Property verifies the validity of the record in current sub-data storehouse;
The attribute comprises at least:The deposit position of file and the last modification time of file.
In some optional embodiments, in addition to:
If the file corresponding to the deposit position attribute of file is present, and the last modification time of the file does not become
Change, illustrate there is this document really in the storage device, then it represents that the record is effective.
In some optional embodiments, in addition to:
If the file corresponding to the deposit position attribute of file is not present, there is no this article in storage device belonging to explanation
Part, then it represents that the protocol failure, now by the record deletion, continue checking for next record.
In some optional embodiments, in addition to:
If the file corresponding to the deposit position attribute of file is present, but the last modification time of the file has change
Change, then delete the record, scanning to be preserved again to the information of this document after waiting, continue checking for next note
Record.
In some optional embodiments, when the spider module travels through to obtain a file, check in the subdata base
Whether the record of this document is related to;If no, obtaining this document information, and the fileinfo got is preserved to the son
In database, traversal is then proceeded to until traversal is completed;If so, then skip acquisition file information block, continue to travel through next
File.
In some optional embodiments, in addition to:
Notification module, for being completed when scanning, notify other programs.
In some optional embodiments, if the multiple storage devices of carry simultaneously, system sends carry broadcast, described to sweep
Module is retouched to start to perform scanning by carry order to each storage device according to the broadcast of the carry received;
The creation module, corresponded to respectively for each storage device create one it is corresponding with No. UUID of the storage device
Subdata base, and store.
In some optional embodiments, in addition to Unload module;
When removing or unloading the storage device, system sends removal or unloading broadcast, the Unload module receive shifting
Broadcast is removed or unloaded, deletes the record of all about storage device in the public database, and closes and is deposited with this
Store up subdata base corresponding to equipment.
In some optional embodiments, if removing or unloading simultaneously multiple storage devices, system sends removal or unloaded
The broadcast of load, the Unload module can start to delete institute by removal or sequence of unloading according to the removal or the broadcast of unloading received
The record of all about each storage device in public database is stated, and closes subdata corresponding with each storage device
Storehouse.
Using scheme provided by the invention, user is set quickly to have access to the storage device often used on the device
In fileinfo, and can need not make an amendment can according to the andriod SDK apk developed and normally access data
Storehouse, there is good versatility for various storage devices.
For above-mentioned and related purpose, one or more embodiments include will be explained in below and in claim
In the feature that particularly points out.Following explanation and accompanying drawing describe some illustrative aspects in detail, and its instruction is only
Some modes in the utilizable various modes of principle of each embodiment.Other benefits and novel features will be under
The detailed description in face is considered in conjunction with the accompanying and becomes obvious, the disclosed embodiments be will include all these aspects and they
Be equal.
Figure of description
Fig. 1 is the schematic flow sheet of carry storage device provided in an embodiment of the present invention;
Fig. 2 is the schematic flow sheet of unloading storage device provided in an embodiment of the present invention;
Fig. 3 is the schematic flow sheet of another carry storage device provided in an embodiment of the present invention;
Fig. 4 is the schematic flow sheet of another unloading storage device provided in an embodiment of the present invention;
Fig. 5 is a kind of structural representation for realizing file scan and the device preserved provided in an embodiment of the present invention;
Fig. 6 is the structural representation that another kind provided in an embodiment of the present invention realizes file scan and the device preserved.
Embodiment
The following description and drawings fully show specific embodiments of the present invention, to enable those skilled in the art to
Put into practice them.Other embodiments can include structure, logic, it is electric, process and other change.Embodiment
Only represent possible change.Unless explicitly requested, otherwise single component and function are optional, and the order operated can be with
Change.The part of some embodiments and feature can be included in or replace part and the feature of other embodiments.This hair
The scope of bright embodiment includes the gamut of claims, and claims is all obtainable equivalent
Thing.Herein, these embodiments of the invention can individually or generally be represented that this is only with term " invention "
For convenience, and if in fact disclosing the invention more than one, the scope for being not meant to automatically limit the application is to appoint
What single invention or inventive concept.
In order to solve the shortcomings that above-mentioned android scanning and preservation, the embodiment of the present invention is using the multiple media numbers of establishment
According to storehouse:Including being respectively not only file system one subdata base of corresponding establishment of each storage device, and create one more
Public database solves.
In some optional embodiments, there is provided a kind of method realized file scan and preserved.Fig. 1 is of the invention real
The schematic flow sheet of the carry storage device of the offer of example one is provided.As shown in figure 1, this method includes:
Step S101, carry storage device;
Step S102, the storage device is scanned;
Step S103, obtain the universal unique identifier UUID of the file system of the storage device;
Step S104, judge whether there is subdata base corresponding with UUID in system;If so, then open public database,
And subdata base corresponding with storage device;
Step S105, verify the validity of the record in subdata base corresponding with current storage devices;
Step S106, each file in storage device is traveled through, obtain the information of each file in the storage device;
Step S107, after having traveled through, all records on the storage device in subdata base are inquired about, then will inquiry
To record be inserted into public database;
Step S108, terminate scanning.
In some optional embodiments, subdata base, the file for one corresponding storage device of duplicated record is believed
Breath, app inaccessibles;A subdata base in file system correspondence system in each storage device;Subdata base only by
The system is operated and controlled;
Public database, the fileinfo of the storage device for recording current all carries, is additionally operable to supply other application
Program app is accessed and operation.
In some optional embodiments, a kind of method realized file scan and preserved is additionally provided.Fig. 1 is the present invention
The schematic flow sheet for the carry storage device that embodiment one provides.As shown in figure 1, this method includes:
Step S101, carry storage device, system send carry broadcast, start scanner;
Step S102, after scanner receives carry broadcast, the storage device is scanned;
Step S103, obtain the universal unique identifier UUID of the file system of the storage device;
Step S104, judge whether there is subdata base corresponding with UUID in system;Deposited if so, the front mount of explanation crosses this
Equipment is stored up, then opens public database, subdata base corresponding with storage device;
Alternatively, if subdata base not corresponding with UUID, the quantity of existing subdata base is first checked:When existing son
When the quantity of database is more than or equal to specified quantity, then nearest untapped subdata base is deleted, then create with
Subdata base corresponding to storage device, and the subdata base is preserved, then open and the subdata base and public database;When existing
When the quantity of subdata base is less than specified quantity, then subdata base corresponding with the storage device is directly created, and preserved, then beaten
Open and the subdata base and public database.
Alternatively, subdata base, for fileinfo in the file system of one corresponding storage device of duplicated record,
App inaccessibles;A subdata base in file system correspondence system in each storage device;Subdata base is only by this
System is operated and controlled;
Public database, for the fileinfo in the file system for the storage device for recording current all carries, also use
In for other application program app access and operation.
Subdata base is identical with the table structure of public database.
Step S105, verify the validity of the record in subdata base corresponding with current storage devices;
It is alternatively possible to verified according to the attribute for inquiring about all records in subdata base;
Wherein, attribute comprises at least:The deposit position of file and the last modification time of file.
Alternatively, if the file corresponding to the deposit position attribute of file is present, and the last modification time of file does not have
Change, illustrate there is this document in storage device really, then it represents that the record is effective, continues checking for next record.
Alternatively, if the file corresponding to the deposit position attribute of file is not present, in storage device belonging to explanation
There is no this document, then it represents that the protocol failure, now by the record deletion, continue checking for next record.
Alternatively, if the file corresponding to the deposit position attribute of file is present, but the last modification time of file has
Change, illustrates that this document is changed, and the fileinfo that the record preserves is incorrect, then the record is deleted, after waiting
Scan to be preserved again to the information of this document, continue checking for next record.
Step S106, each file in storage device is traveled through, obtain the information of each file in storage device;
Alternatively, when traversal obtains a file, check in the subdata base whether be related to the record of this document;If not yet
Have, then obtain this document information, and the fileinfo got is preserved into the subdata base, then proceed to traversal until time
Completion is gone through, if so, then continuing to travel through next file.
Step S107, after having traveled through, all records on the storage device in subdata base are inquired about, then will inquiry
To record be inserted into public database;
Step S108, terminate scanning.
Optionally, when scanning completion, other programs are notified.
Alternatively, if the multiple storage devices of carry, system send carry broadcast simultaneously, scanner can be according to the extension received
The broadcast of load, start to perform scanning by the order of carry to each storage device;And created for each storage device is corresponding
One and its No. UUID corresponding subdata base are built, and is stored.
Above-described embodiment is the method provided for carry storage device, in some optional embodiments, is additionally provided
A kind of method realized file scan and preserved.Fig. 2 is the flow signal for the unloading storage device that the embodiment of the present invention one provides
Figure.As shown in Fig. 2 this method comprises the following steps:
Step S201, remove or unload storage device;
Step S202, receives removal or unloading broadcast, and system sends removal or unloading broadcast;
Step S203, multimedia content provider can be deleted in public database according to the removal or unloading broadcast received
The record of all about storage device;
Step S204, close subdata base corresponding with the storage device.
If removing or unloading multiple storage devices simultaneously, system sends the broadcast for removing or unloading, and content of multimedia carries
It can be started relevant by institute in the order deletion public database for removing or unloading according to the removal or the broadcast of unloading received for device
In the record of each storage device for being removed or unloading, and close corresponding with each removed or unloading storage device
Subdata base.
Optionally, during the storage device that carry has been crossed before carry again, system sends carry broadcast;Scanner connects
After the carry broadcast received, it is only necessary to open subdata base corresponding with the storage device, the information in the subdata base is entered
Record in the subdata base, is then entirely insertable into public database by row renewal, is accessed for apk.
In some optional embodiments, a kind of method realized file scan and preserved is additionally provided.As shown in figure 3,
Including:
Step S301, carry storage device A, system send carry broadcast;
Step S302, start mediascanner;After mediascanner receives carry broadcast, first storage device A is entered
Row scanning;
Step S303, obtains the universal unique identifier UUID of storage device A ntfs file system, and the UUID is
1234;
Step S304, judge whether to have in system the subnumber with UUID for 1234 corresponding entitled external-1234.db
According to storehouse;If so, the front mount of explanation crosses storage device A, then entitled external.db public database, Yi Jiyu are opened
The corresponding subdata bases with entitled external-1234.db of storage device A;
Alternatively, if not with the subdata base that UUID is 1234 corresponding entitled external-1234.db, illustrate
Storage device A is carry first, then first checks the quantity of existing subdata base:Be more than when the quantity of existing subdata base or
Equal to specified quantity(Such as 5)When, then nearest untapped subdata base is deleted, then created and A pairs of storage device
The entitled external-1234.db answered subdata base and preservation, then open the subdata base and entitled external.db
Public database;When the quantity of existing subdata base is less than specified quantity, then directly create corresponding with storage device A entitled
External-1234.db subdata base and preservation, then open the subdata base and entitled external.db common data
Storehouse.
Entitled external-1234.db subdata base, it is responsible for preserving and the text in storage device A respective file systems
Part information, being controlled by the mediascanner and mediaprovider of the system, other application program app can not operate to it,
Other app inaccessibles;A subdata base in file system correspondence system in each storage device;
Entitled external.db public database, it is responsible for recording the fileinfo of all file system of carry, it is convenient
App goes to access.
Subdata base is identical with the table structure of public database.
The corresponding multimedia database of file system in i.e. each storage device, passes through the UUID of file system(Only
One identifier)To create database correspondingly, such as ntfs file system storage devices A UUID is 1234, then it is right
The database name answered is designed as external-1234.db, and the external-1234.db is only recorded in relevant storage device A
Fileinfo;Entitled external.db public database is created again in addition to record in current all carry equipment
Fileinfo, app is facilitated to access so that the disposable cans of application program app access the fileinfo in all devices, meet
The apk developed according to android SDK.As unloading equipment A, mediaprovider receives EJECT broadcast, only deletes
Record information about device A in external.db databases, and external-1234.db. corresponding to pass hull closure A works as
Again during carry device A, after mediascanner receives MOUNT broadcast, it is only necessary to open database external-
1234.db, the information in externa-1234.db is updated, it is then that the record in external-1234.db is whole
It is inserted into external.db databases and is accessed for apk.
Step S305, mediascanner verify the record in current entitled external-1234.db subdata base
Validity.
Specifically, can be verified according to the attribute for inquiring about all records in the subdata base.
Wherein, the attribute comprises at least:Attribute _ data(The deposit position of file)With attribute lastModified(File
Last modification time).There are following several situations:
If the file corresponding to attribute _ data is present, and lastModified does not change, and illustrates in storage device A
Really there is this document, then it represents that the record is effective, continues checking for next record.
If the file corresponding to attribute _ data is not present, there is no this document in storage device A belonging to explanation, then table
Show the protocol failure, now by the record deletion, continue checking for next record.
If the file corresponding to attribute _ data is present, but lastModified is changed, and illustrates that this document is repaiied
Change, the fileinfo that the record preserves is incorrect, also deletes the record, scanning to enter to the information of this document after waiting
Row preserves again, continues checking for next record.
Each file in step S306, traverse scanning storage device A, obtain the letter of each file in storage device A
Breath;
Alternatively, when traversal obtains a file, check in the subdata base whether be related to the record of this document;If not yet
Have, then obtain this document information, and the fileinfo got is preserved to entitled external-1234.db subdata base
In, traversal is then proceeded to until traversal completion, if so, then continuing to travel through next file.
Step S307, after having traveled through, inquire about in entitled external-1234.db subdata base on storage device A
All records, then the record inquired is preserved into public database external.db, for apk access;
Step S308, terminate scanning.
Optionally, when scanning completion, other programs are notified.
Alternatively, if multiple storage devices of carry simultaneously:Storage device A, storage device B and storage device C are hung one by one
Carrying, mediascanner can start to perform scanning according to the order of carry to each storage device according to the carry broadcast received,
Storage device A is first scanned, then scans storage device B, then scans storage device C;And created for each storage device is corresponding
One and its No. UUID corresponding subdata base are built, and is stored.
As shown in figure 4, when needing to remove or unload storage device A, comprise the following steps:
Step S401, remove or unload storage device A;
Step S402, multimedia content provider mediaprovider receive the EJECT broadcast for removing or unloading;
Step S403, only delete all records letter about storage device A in public database external.db databases
Breath;
Step S404, close entitled external-1234.db corresponding with storage device A subdata base.
When carry device A again, comprise the following steps:After mediascanner receives the broadcast of MOUNT carries, only need
Entitled external-1234.db subdata base is opened, the information in the database is updated, then will be entitled
Record in external-1234.db subdata base is all directed into entitled external.db public database, is supplied
Apk is accessed.
Using scheme provided in an embodiment of the present invention, user is set quickly to have access to often in the andriod equipment
Fileinfo in the storage device used, and can need not be made an amendment according to the andriod SDK apk developed
It is normal to access database, there is good versatility for various storage devices.
In some optional embodiments, a kind of method realized file scan and preserved is additionally provided.
Step S501, first carry storage device A, then carry storage device B, system send carry broadcast;
Step S502, system start mediascanner and storage device A are scanned after carry broadcast is received;
Step S503, obtains the universal unique identifier UUID of storage device A ntfs file system, and the UUID is
1234;
Step S504, judge whether to have in system the subnumber with UUID for 1234 corresponding entitled external-1234.db
According to storehouse;If so, the front mount of explanation crosses storage device A, then entitled external.db public database, Yi Jiyu are opened
The corresponding subdata bases with entitled external-1234.db of storage device A;
Alternatively, if not with the subdata base that UUID is 1234 corresponding entitled external-1234.db, illustrate
Storage device A is carry first, then first checks the quantity of existing subdata base:Be more than when the quantity of existing subdata base or
Equal to specified quantity(Such as 4)When, then nearest untapped subdata base is deleted, then created and A pairs of storage device
The entitled external-1234.db answered subdata base and preservation, then open the subdata base and entitled external.db
Public database;When the quantity of existing subdata base is less than specified quantity, then directly create corresponding with storage device A entitled
External-1234.db subdata base and preservation, then open the subdata base and entitled external.db common data
Storehouse.
Step S505, mediascanner verify the record in current entitled external-1234.db subdata base
Validity.
Specifically, can be verified according to the attribute for inquiring about all records in the subdata base.
Wherein, the attribute comprises at least:Attribute _ data(The deposit position of file)With attribute lastModified(File
Last modification time).There are following several situations:
If the file corresponding to attribute _ data is present, and lastModified does not change, and illustrates in storage device A
Really there is this document, then it represents that the record is effective, continues checking for next record.
If the file corresponding to attribute _ data is not present, there is no this document in storage device A belonging to explanation, then table
Show the protocol failure, now by the record deletion, continue checking for next record.
If the file corresponding to attribute _ data is present, but lastModified is changed, and illustrates that this document is repaiied
Change, the fileinfo that the record preserves is incorrect, also deletes the record, scanning to enter to the information of this document after waiting
Row preserves again, continues checking for next record.
Each file in step S506, traversal storage device A, obtain the information of each file in storage device A;
Alternatively, when traversal obtains a file, check in the subdata base whether be related to the record of this document;If not yet
Have, then obtain this document information, and the fileinfo got is preserved to entitled external-1234.db subdata base
In, traversal is then proceeded to until traversal completion, if so, then continuing to travel through next file.
Entitled external-1234.db subdata base, it is responsible for preserving and the text in storage device A respective file systems
Part information, is controlled by mediascanner, and other application program app can not operate to it, other app inaccessibles;Each deposit
Store up a subdata base in the file system correspondence system in equipment;
Step S507, after having traveled through, inquire about in entitled external-1234.db subdata base on storage device A
All records, then the record inquired is inserted into public database external.db, for apk access;
Step S508, terminate scanning storage device A;
Step S509, start mediascanner and storage device B is scanned;
Step S510, the universal unique identifier UUID for obtaining storage device B ntfs file system are 5678;
Step S511, judge whether to have in system the subnumber with UUID for 5678 corresponding entitled external-5678.db
According to storehouse;If so, the front mount of explanation crosses storage device B, then entitled external.db public database, Yi Jiyu are opened
Entitled external-5678.db subdata base corresponding to storage device B;
If the storage device is not illustrated with the subdata base that UUID is 5678 corresponding entitled external-5678.db
B is carry first, then first checks the quantity of existing subdata base:Number is specified when the quantity of existing subdata base is more than or equal to
Amount(Such as 6)When, then nearest untapped subdata base is deleted, then created corresponding with storage device B entitled
External-5678.db subdata base and preservation, then open the subdata base and entitled external.db common data
Storehouse;When the quantity of existing subdata base is less than specified quantity, then directly create corresponding with storage device B entitled
External-5678.db subdata base and preservation, then open the subdata base and entitled external.db common data
Storehouse.
Entitled external-5678.db subdata base, it is responsible for preserving and the text in storage device B respective file systems
Part information, is controlled by mediascanner, and other application program app can not operate to it, other app inaccessibles;Each deposit
Store up a subdata base in the file system correspondence system in equipment;
Entitled external.db public database, it is responsible for recording all storage device of carry A and storage device B
The fileinfo of file system, app is facilitated to go to access.
Subdata base is identical with the table structure of public database.
Step S512, mediascanner verify the record in current entitled external-5678.db subdata base
Validity, it can be verified according to the attribute for inquiring about all records in the subdata base, attribute comprises at least:Attribute _ data
(The deposit position of file)With attribute lastModified(The last modification time of file).There are following several situations:
If the file corresponding to attribute _ data is present, and lastModified does not change, and illustrates in storage device B
Really there is this document, then it represents that the record is effective, continues checking for next record.
If the file corresponding to attribute _ data is not present, there is no this document in storage device B belonging to explanation, then table
Show the protocol failure, now by the record deletion, continue checking for next record.
If the file corresponding to attribute _ data is present, but lastModified is changed, and illustrates that this document is repaiied
Change, the fileinfo that the record preserves is incorrect, then deletes the record, scanning to enter to the information of this document after waiting
Row preserves again, continues checking for next record.
Each file in step S513, traversal storage device B, obtain the information of each file in storage device B;
Alternatively, when traversal obtains a file, check in the subdata base whether be related to the record of this document, if not having
Have, then obtain this document information, and the fileinfo got is preserved to entitled external-5678.db subdata base
In, traversal is then proceeded to until traversal completion, if so, then continuing to travel through next file.
Step S514, after having traveled through, inquire about in entitled external-5678.db subdata base on storage device B
All records, then the record inquired is inserted into public database external.db, for apk access;
Step S515, terminate scanning storage device B.
Optionally, when scanning completion, other programs are notified.
Using scheme provided in an embodiment of the present invention, user is set quickly to have access to often in the andriod equipment
Fileinfo in the storage device used, and can need not be made an amendment according to the andriod SDK apk developed
It is normal to access database, there is good versatility for various storage devices.
In some optional embodiments, there is provided a kind of device realized file scan and preserved.Fig. 5 is of the invention real
A kind of structural representation for realizing file scan and the device preserved of example offer is provided.As shown in figure 5, the device includes:Scanning
Module 11, discrimination module 12, authentication module 13, spider module 14, acquisition file information block 15 and enquiry module 16;Wherein,
Scan module 11, for being scanned to the storage device of carry, and obtain the general unique mark of storage device
Accord with UUID;
Discrimination module 12, for judging whether there is subdata base corresponding with UUID in system;If so, then open public number
According to storehouse, and subdata base corresponding with storage device;
Authentication module 13, for verifying the validity of the record in subdata base corresponding with current storage devices;
Spider module 14, for traveling through each file in storage device;
File information block 15 is obtained, for obtaining the information of each file in storage device;With,
Enquiry module 16, for inquiring about all records in subdata base on the storage device, then it will inquire
In record insertion public database.
In some optional embodiments, as shown in fig. 6, the device also includes creation module 17;
Discrimination module 12, if differentiating subdata base not corresponding with UUID, first check the quantity of existing subdata base;
When the quantity of existing subdata base is more than specified quantity, then nearest untapped subdata base is deleted, then notified
Creation module 17;When the quantity of existing subdata base is less than specified quantity, then creation module 17 is directly notified;
Creation module 17, for creating subdata base corresponding with storage device, and preserve;
Then the discrimination module, then public database is opened, and the subdata base created with creation module 17.
Wherein, subdata base, for the fileinfo of one corresponding storage device of duplicated record, in each storage device
File system correspondence system in a subdata base;The subdata base is only operated and controlled by the system of the present apparatus
System;
Public database, the fileinfo of the storage device for recording current all carries, is additionally operable to supply other application
Routine access and operation.
Optionally, authentication module 13, work as specifically for the attribute of all records in inquiry subdata base to verify
The validity of record in preceding subdata base, attribute comprise at least:The deposit position of file and the last modification time of file.Tool
Body includes following several situations:
If the file corresponding to the deposit position attribute of file is present, and the last modification time of file does not change,
Illustrate there is this document in storage device really, then it represents that the record is effective, continues checking for next record;
If the file corresponding to the deposit position attribute of file is not present, there is no this article in storage device belonging to explanation
Part, then it represents that the protocol failure, now by the record deletion, continue checking for next record;
If the file corresponding to the deposit position attribute of file is present, but the last modification time of file changes, and says
Bright this document is changed, and the fileinfo that the record preserves is incorrect, then deletes the record, next pair of the scanning after waiting
The information of this document is preserved again, continues checking for next record.
Optionally, when spider module 14, traversal obtain a file, check in the subdata base whether be related to this document
Record;If no, obtaining this document information, and the fileinfo got is preserved into the subdata base, Ran Houji
Continuous traversal is completed until traversal, if so, then skipping acquisition file information block, continues to travel through next file.
The device is also possible that:Notification module 18(It is not drawn into figure), for being completed when scanning, notify other programs.
If the multiple storage devices of carry simultaneously, system sends carry broadcast, and scan module 11 can be according to the carry received
Broadcast, start to perform scanning by the order of carry to each storage device;Creation module 17, for each storage device point
A No. UUID corresponding subdata base with the storage device Dui Ying not be created, and is stored.
Optionally, the device also includes Unload module 19(It is not drawn into figure), when removing or unloading storage device, system
Removal or unloading broadcast are sent, Unload module 19 receives removal or unloading broadcast, deletes all about this in public database and deposits
The record of equipment is stored up, and closes subdata base corresponding with the storage device.
If removing or unloading multiple storage devices simultaneously, system sends the broadcast for removing or unloading, the meeting of Unload module 19
According to the removal or the broadcast of unloading received, start by all about in the order deletion public database for removing or unloading
The record of each storage device, and close subdata base corresponding with each storage device for being removed or unloading.
Using scheme provided in an embodiment of the present invention, user is set quickly to have access to often in the andriod equipment
Fileinfo in the storage device used, and can need not be made an amendment according to the andriod SDK apk developed
It is normal to access database, there is good versatility for various storage devices.
Unless otherwise specific statement, term such as handle, calculate, computing, determination, display etc. can refer to it is one or more
Individual processing or action and/or the process of computing system or similar devices, the action and/or process will be indicated as processing system
The data manipulation of physics (such as electronics) amount in the register or storage device of system and it is converted into and is similarly represented as processing system
Other data of the storage device of system, the register either storage of other this type of informations, transmitting or the physical quantity in display device.
Information and signal can be represented using any one of a variety of different technologies and method.For example, retouched through above
Data, instruction, order, information, signal, bit, symbol and the chip referred in stating can use voltage, electric current, electromagnetic wave, magnetic field
Or particle, light field or particle or its any combination represent.
It should be understood that the particular order or level of the step of during disclosed are the examples of illustrative methods.Based on setting
Count preference, it should be appreciated that during the step of particular order or level can be in the feelings for the protection domain for not departing from the disclosure
Rearranged under condition.Appended claim to a method gives the key element of various steps with exemplary order, and not
It is to be limited to described particular order or level.
In above-mentioned detailed description, various features combine in single embodiment together, to simplify the disclosure.No
This open method should be construed to reflect such intention, i.e. the embodiment of theme claimed needs clear
The more features of feature stated in each claim to Chu.On the contrary, that reflected such as appended claims
Sample, the present invention are in the state fewer than whole features of disclosed single embodiment.Therefore, appended claims is special
This is expressly incorporated into detailed description, and wherein each claim is alone as the single preferred embodiment of the present invention.
It should also be appreciated by one skilled in the art that the various illustrative boxes described with reference to the embodiments herein, mould
Block, circuit and algorithm steps can be implemented as electronic hardware, computer software or its combination.In order to clearly demonstrate hardware and
Interchangeability between software, various illustrative part, frame, module, circuit and steps are carried out around its function above
It is generally described.Hardware is implemented as this function and is also implemented as software, depending on specific application and to whole
The design constraint that system is applied.Those skilled in the art can be directed to each application-specific, be realized in a manner of flexible
Described function, it is still, this to realize that decision-making should not be construed as the protection domain away from the disclosure.
The step of method or algorithm with reference to described by the embodiments herein, can be embodied directly in hardware, be held by processor
Capable software module or its combination.Software module can be set positioned at RAM storage devices, flash memory, ROM storage devices, EPROM storages
Standby, EEPROM memory device, register, hard disk, mobile disk, CD-ROM or any other form well known in the art are deposited
In storage media.A kind of exemplary storage medium is connected to processor, believes so as to enable a processor to read from the storage medium
Breath, and information can be write to the storage medium.Certainly, storage medium can also be the part of processor.Processor and deposit
Storage media can be located in ASIC.The ASIC can be located in user terminal.Certainly, processor and storage medium can also conducts
Discrete assembly is present in user terminal.
Realized for software, technology described in this application can use the module for performing herein described function (for example, mistake
Journey, function etc.) realize.These software codes can be stored in storage device unit and by computing device.Storage device list
Member can be realized in processor, can also be realized outside processor, and in the latter case, it is via various means to communicate
Mode is coupled to processor, and these are all well known in the art.
Described above includes the citing of one or more embodiments.Certainly, in order to above-described embodiment is described and description portion
The all possible combination of part or method is impossible, but it will be appreciated by one of ordinary skill in the art that each implementation
Example can do further combinations and permutations.Therefore, embodiment described herein is intended to fall into appended claims
Protection domain in all such changes, modifications and variations.In addition, with regard to the term used in specification or claims
"comprising", the mode that covers of the word are similar to term " comprising ", just as " including " solved in the claims as link word
As releasing.In addition, the use of any one term "or" in the specification of claims is to represent " non-exclusionism
Or ".