CN105700825A - Thumbnail storage method and device based on Android system - Google Patents
Thumbnail storage method and device based on Android system Download PDFInfo
- Publication number
- CN105700825A CN105700825A CN201511019283.5A CN201511019283A CN105700825A CN 105700825 A CN105700825 A CN 105700825A CN 201511019283 A CN201511019283 A CN 201511019283A CN 105700825 A CN105700825 A CN 105700825A
- Authority
- CN
- China
- Prior art keywords
- thumbnail
- byte stream
- file
- storage
- memory space
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a thumbnail storage method and device based on an Android system. The method comprises the following steps: establishing a new index file in a folder to which a thumbnail byte stream storage file belongs; when a new picture is added in the database of the Android system, generating the thumbnail corresponding to the new picture, and converting the thumbnail into the thumbnail byte stream; searching the tail position of the thumbnail byte stream storage file, and storing the converted thumbnail byte stream into the tail position of the thumbnail byte stream storage file; and recording the storage position information of the thumbnail byte stream into the index file. The technical scheme adds the index file and records the storage position information of the thumbnail byte stream into the index file, so that the thumbnail can be searched according to the index file, each position in the thumbnail byte stream storage file stores effective data to solve the problem that storage space is severely wasted when the Android system stores the thumbnail, and the storage space is saved.
Description
Technical field
The present invention relates to android system technical field, be specifically related to a kind of thumbnail storage method and apparatus based on android system。
Background technology
Android (Chinese name, Android) system, is a mobile device operation system increased income based on Linux, is mainly used in the intelligent terminal such as smart mobile phone and panel computer。Android system adopts SQLite data base administration local file, and SQLite is a light-duty, relevant database。
Fig. 1 is the schematic flow sheet that local data is managed by Android device。Referring to the step S11 in Fig. 1 to step S15;Step S11, a newly-increased file → step S12, be inserted into data base → step S13 by this document, judge that whether this document is picture → be then, perform step S14 by the common thumbnail of thread creation (otherwise, process ends) → step S15, by thread creation micro-thumbnail。Such as, when being mounted with that the mobile phone of android system is by taking pictures or when other modes have increased a pictures newly, system can create thread and generate two kinds of thumbnails, and a kind of is relatively large sized common thumbnail correspondence step S14;Another kind is miniature thumbnail correspondence step S15 (namely the present invention is the improvement to this micro-thumbnail storage scheme, and the thumbnail hereinafter occurred refers to this micro-thumbnail)。The purposes of the micro-thumbnail generated in step S15 is widely。Such as, use during the up-to-date figure of the interface display of taking pictures of the camera in Android phone, or take pictures software picture mosaic third party, and use time the picture of the reduced sizes such as user's head portrait in immediate communication tool is set。
Android system is in order to reduce the fragmentation of file and improve access speed, these micro-thumbnail are converted to thumbnail byte stream when storing micro-thumbnail, it is saved in thumbnail byte stream storage file (i.e. thumbdata file) under DCIM/Camera/.thumnail/thumbdata path, and sorts according to the data base ID that thumbnail is corresponding。Fig. 2 is the ID database fragment schematic diagram from 18 to 28 in the Android local data base opened by SQLite visualization tool, Fig. 3 is the data store organisation schematic diagram of thumbdata file, as shown in Figure 2, in existing android system, data file is continuous and incremental in the unique ID that the local data library storage time-division is fitted on, ID be the location records of 27 and 28 be pictorial information。Referring to Fig. 3, in order to ensure can directly to find the thumbnail byte stream of correspondence position in thumbdata file according to picture corresponding to thumbnail ID in data base。In the position that ID is 27 and 28 correspondences, only preserve valid data when android system stores in thumbdata file, and the position that thumbdata file correspondence ID is 1 to 26 preserves is invalid data (i.e. cover data)。Each thumbnail byte stream takies the memory space of 10kb in thumbdata file, and the position not storing thumbnail byte stream in such thumbdata file needs with the 0x00 polishing of 10kb。It follows that this storage mode result in a lot of positions in thumbdata file needs invalid data 0x00 cover, cause the significant wastage of memory space。
Such as, when only having a pictures A in an Android phone, and when the ID that picture A distributes in the local database is 100000, the size of thumbdata file is then 100000*10kb=1GB。If opening the thumbnail byte stream storage file of this 1GB with super editing machine, it will be seen that a large amount of " 0000000000 ... " such invalid datas, and valid data only account for a little。Actually, under this memory module, thumbdata file size depends on the data base ID that a up-to-date pictures is corresponding, even if local data base only stores a pictures, and data base ID corresponding to this picture is 10000, before so in thumbdata file, the position of 99999*10kb is all invalid data, and only last position stores thumbnail byte stream (what namely store is valid data)。
Especially at Android in order to ensure uniqueness and the database security of each data base's ID corresponding data, the ID in data base is continually incremented and under not reusable premise。ID is once be previously used, even if data are deleted, ID is without re-using。So, when an Android phone uses the several months, the ID in data base on average can reach more than 100000。It is obvious that thumbnail storage scheme causes the serious waste of memory space in existing android system, it would be highly desirable to solve。
Summary of the invention
The invention provides a kind of thumbnail storage method and apparatus based on android system, with the problem solving the memory space serious waste that in existing android system, thumbnail storage scheme causes。
According to an aspect of the invention, it is provided a kind of thumbnail storage method based on android system, the method includes:
Newly-built index file in the file that thumbnail byte stream stores belonging to file;
When newly-increased picture in the data base of android system, generate the thumbnail that newly-increased picture is corresponding, thumbnail is converted to thumbnail byte stream;
Search the tail position of thumbnail byte stream storage file, the thumbnail byte stream after conversion is stored the tail position of thumbnail byte stream storage file so that in thumbnail byte stream storage file, the storage of each position is valid data;
The storage positional information of thumbnail byte stream be recorded in index file。
Alternatively, the storage positional information of thumbnail byte stream be recorded index file to include:
Utilizing newly-increased picture unique ID in the data base of android system, the storage positional information of thumbnail byte stream be recorded the n-th position in index file, wherein N is equal to unique ID;And, by before n-th position in index file and do not record thumbnail byte stream storage positional information position invalid data fill。
Alternatively, the method farther includes:
When receiving the thumbnail byte stream search request comprising unique ID, search index file according to unique ID, find the n-th position that unique ID is corresponding;
Utilize the storage positional information of the thumbnail byte stream of the n-th location records found, store at described thumbnail byte stream and file obtains thumbnail byte stream and returns。
Alternatively, in index file, every record takies the memory space of nine bytes, and wherein storage Byte byte type data in the memory space of first character joint, store Long long data in the memory space of second to the 9th byte;
Or, in index file, every record takies the memory space of eight bytes, stores Long long data in the memory space of these eight bytes。
Alternatively, when in index file, every record takies the memory space of nine bytes, whether the data of the memory space saved by the first character in the memory space of nine bytes, as flag bit, store the storage positional information of thumbnail byte stream for this record of labelling;It is then, show that what the memory space of in the memory space of nine bytes second to the 9th byte deposited is the storage positional information of thumbnail byte stream, otherwise, it was shown that what second in the memory space of nine bytes to the memory space of the 9th byte was deposited is invalid data。
According to another aspect of the present invention, it is provided that a kind of thumbnail storage device based on android system, this device includes:
Index file creation unit, for storing newly-built index file in the file belonging to file at thumbnail byte stream;
Thumbnail converting unit, for when increasing picture in the data base of android system newly, generating the thumbnail that newly-increased picture is corresponding, thumbnail be converted to thumbnail byte stream;
Memory element, for searching the tail position of thumbnail byte stream storage file, stores the tail position of thumbnail byte stream storage file by the thumbnail byte stream after conversion so that in thumbnail byte stream storage file, the storage of each position is valid data;
Index position record unit, for recorded the storage positional information of thumbnail byte stream in index file。
Alternatively, index position record unit, specifically for utilizing newly-increased picture unique ID in the data base of android system, the storage positional information of thumbnail byte stream be recorded the n-th position in index file, wherein N is equal to unique ID;And, by before n-th position in index file and do not record thumbnail byte stream storage positional information position invalid data fill。
Alternatively, device also includes:
Index search unit, for when receiving the thumbnail byte stream search request comprising unique ID, searching index file according to unique ID, find the n-th position that unique ID is corresponding;
Utilize the storage positional information of the thumbnail byte stream of the n-th location records found, store at thumbnail byte stream and file obtains thumbnail byte stream and returns。
Alternatively, in index file, every record takies the memory space of nine bytes, and wherein storage Byte byte type data in the memory space of first character joint, store Long long data in the memory space of the second to nine byte;Or, in index file, every record takies the memory space of eight bytes, stores Long long data in the memory space of these eight bytes。
Alternatively, when in index file, every record takies the memory space of nine bytes, whether the data of the memory space saved by the first character in the memory space of nine bytes, as flag bit, store the storage positional information of thumbnail byte stream for this record of labelling;It is then, show that what the memory space of in the memory space of nine bytes second to the 9th byte deposited is the storage positional information of thumbnail byte stream, otherwise, it was shown that what second in the memory space of nine bytes to the memory space of the 9th byte was deposited is invalid data。
The invention has the beneficial effects as follows: compared with the existing storage scheme of android system, the technical scheme of the embodiment of the present invention is by increasing an index file saving very much memory space, in the storage location records of thumbnail byte stream to the index file of this increase, will go to search the actual location of thumbnail byte stream in thumbnail byte stream storage file again subsequently through the storage positional information of record in index file。So, by changing the storage mode of the data base ID corresponding according to picture, make thumbnail byte stream storage file in all positions preserve be all valid data, eliminate the filling of invalid data, solve the problem of memory space serious waste during android system storage thumbnail, save system memory space, improve data search speed and systematic function。
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet that local data is managed by Android device;
Fig. 2 be the Android local data base ID that opened by SQLite visualization tool from 18 to 28 database fragment schematic diagram;
Fig. 3 is the data store organisation schematic diagram of thumbdata file;
Fig. 4 is the schematic flow sheet of a kind of thumbnail storage method based on android system of one embodiment of the invention;
Fig. 5 applies the schematic flow sheet that a kind of thumbnail storage method based on android system of one embodiment of the invention stores and searches;
Fig. 6 is the index file of one embodiment of the invention and the schematic diagram of the storage organization of thumbnail byte stream storage file and both corresponding relations;
Fig. 7 be one embodiment of the invention index file in the structural representation of an entry index record;
Fig. 8 be another embodiment of the present invention index file in the structural representation of an entry index record;
A kind of structure journey schematic diagram of the thumbnail storage device based on android system of Fig. 9 one embodiment of the invention。
Detailed description of the invention
The core concept of the present invention is: in prior art during android system storage thumbnail according to the ID storage in the local database of picture corresponding to thumbnail time, need with substantial amounts of invalid data occupy-place (to ensure can directly find thumbnail byte stream position in thumbdata file according to picture corresponding to thumbnail ID in data base), the problem wasting memory space greatly, by increasing an index file thumbindex saving very much memory space, index file thumbindex is utilized to go to search the thumbnail byte stream in thumbnail byte stream storage file thumbdata again, it is all effective for making the data that in thumbdata file, all positions preserve, eliminate and fill the space waste that invalid data causes in thumbdata file, thus saving system memory space。
Fig. 4 is the schematic flow sheet of a kind of thumbnail storage method based on android system of one embodiment of the invention, referring to Fig. 4, should comprise the following steps: based on the thumbnail storage method of android system
Step S41, newly-built index file in the file that thumbnail byte stream stores belonging to file;
Step S42, in the data base of described android system during newly-increased picture, generates the thumbnail that described newly-increased picture is corresponding, described thumbnail is converted to thumbnail byte stream;
Step S43, search the tail position of described thumbnail byte stream storage file, thumbnail byte stream after conversion is stored the tail position of described thumbnail byte stream storage file so that in thumbnail byte stream storage file, the storage of each position is valid data;
Step S44, recorded the storage positional information of thumbnail byte stream in described index file。
Through the step shown in Fig. 4, the thumbnail storage method of the android system of the embodiment of the present invention by storing newly-built index file in the file belonging to file at thumbnail byte stream, and when thumbnail byte stream stores newly-increased thumbnail byte stream in file, the storage positional information throttled by this added word recorded relevant position in this index file, so, follow-up can lookup according to the index record of relevant position in index file removes thumbnail byte stream storage file, obtains thumbnail byte stream。So, the such valid data of thumbnail byte stream just can only be deposited by thumbnail byte stream storage file, without filling invalid data occupy-place, thus saving memory space。
It should be noted that, in the present embodiment, valid data in index file refer to, indicate the data of thumbnail byte stream positional information in thumbnail byte stream storage file, invalid data is then the data of the positional information not indicating thumbnail byte stream in thumbnail byte stream storage file, in the present embodiment, in index file, invalid data represents with 0。Valid data in thumbnail byte stream storage file refer to thumbnail byte stream, and invalid data is to represent with 0。
Fig. 5 applies the schematic flow sheet that a kind of thumbnail storage method based on android system of one embodiment of the invention stores and searches, Fig. 6 is the schematic diagram of the storage organization of the index file of one embodiment of the invention and thumbnail byte stream storage file and both corresponding relations, Fig. 7 be one embodiment of the invention index file in the structural representation of an entry index record;Below in conjunction with Fig. 5 to Fig. 7, this step that realizes based on the thumbnail storage method of android system of the present embodiment is described in detail。
In Figure 5, step S51 to step S53 is after adding index file, the Stored Procedure of thumbnail byte stream。Referring to Fig. 5, step S51, search the position of thumbdata file most end。
Here it is when android system data base having increased newly a pictures (including photo) and data base ID being assigned, when converting thumbnail byte stream to and wait that being saved in thumbnail byte stream stores in file (i.e. thumbdata file), it is necessary to search the position of thumbdata file most end so that thumbnail byte stream corresponding for newly-increased picture is stored this position。It should be noted that generate thumbnail corresponding to newly-increased picture and thumbnail is converted to thumbnail byte stream is prior art, it is possible to adopt prior art means to realize, repeat no more here。
Step S52, after finding the position of most end, thumbnail byte stream is stored to the position of thumbdata file most end, and this positional information be recorded position corresponding in index file thumbindex, with 0, the inoperative position before this position is filled occupy-place, and position corresponding here is determined by the data base ID that this thumbnail byte stream is corresponding。
Concrete, by the File.length () function of Java in the present embodiment, the size (length) directly taking thumbdata file obtains the position of thumbdata end of file。Due in thumbdata file every record be sized to 10kb, the data header of these 10Kb data includes the real length information of this thumbnail byte stream, when being obtained the length of current thumbdata file by File.length () function, the position of thumbdata file most end。
Referring to Fig. 6,61 expressions are index file (thumbindex files), and 62 represent the storage file (i.e. thumbdata file) of thumbnail byte streams。In the present embodiment, the storage positional information of thumbnail byte stream be recorded index file include: utilize newly-increased picture unique ID in the data base of android system, the storage positional information of thumbnail byte stream be recorded n-th position in index file, and N is equal to unique ID;And, by before n-th position in index file and do not record thumbnail byte stream storage positional information position invalid data fill。
Concrete, in conjunction with Fig. 2, for instance, the ID that current newly-increased picture distributes in data base is 27 (assuming that the picture that ID is 27 is the first pictures in data base), when storage, system generates the thumbnail of this newly-increased picture, and this thumbnail is converted to thumbnail byte stream。The position of thumbdata file most end is taken (owing at this moment thumbdata file is but without storage thumbnail byte stream by File.length () function, so the position of most end is first position) this thumbnail byte stream is stored in first position of thumbdata file, then the information of first position be recorded corresponding position in thumbindex index file。
Referring to Fig. 6, in the present embodiment, owing to the unique ID in the thumbnail byte stream correspondence database of first position of thumbdata file is 27, so the storage positional information (first position) of thumbdata file thumbnail byte stream being recorded the 27th position of index file according to this unique ID during concrete storage。The sequence number " 1,2,3 ... N " on index file 61 left side represents the unique ID in sequence of positions correspondence database, that is, record in index file thumbindex also stores in order, and this order is exactly the ID that newly-increased picture distributes in data base。As shown in Figure 2, in data base ID be the position storage of 1 to 26 correspondences be not picture so the position of the 1st to 26 needs to fill with invalid data in indexed file, so can ensure that the relevant position searching index file according to the ID in data base, further according to the positional information of relevant position storage in index file thus finding the thumbnail byte stream in thumbdata file。
Referring to Fig. 7, in the present embodiment, in index file, every record takies the memory space of nine bytes, what wherein store in the memory space 71 of first character joint is Byte byte type data, in the memory space 72 of the second to nine byte, storage is Long long data, in the present embodiment, whether the data in the memory space 71 save the first character in the memory space of nine bytes, as flag bit, store the storage positional information of thumbnail byte stream for this record of labelling;It is then, show that what the memory space 72 of in the memory space of nine bytes second to the 9th byte deposited is the storage positional information of thumbnail byte stream, otherwise, it was shown that what second in the memory space of nine bytes to the memory space of the 9th byte was deposited is invalid data。
Concrete, referring to Fig. 6, in the present embodiment, every record in index file 61 takies the memory space of nine bytes, and first character joint storage is Byte type data, wherein represents flag bit with 00 and 01, mark whether that for significance bit, data 00 are set to invalid bit, and data 01 are set to significance bit。Such as, after the 27th position in index file stores the thumbnail byte stream such valid data of the positional information in thumbdata, perform step S53, the data that first character in the memory space of nine bytes of the 27th position saves are set to 01, and what represent this location records is valid data (what namely record is thumbnail byte stream storage position in thumbdata)。Concrete application process can the flag bit of all records of default setting be 00 in first indexed file, after only storing valid data in the memory space of the second of this position to the 9th byte, the value that the first character of this position saves Byte is set to 01, and what show to store in index file with this is valid data。
When so searching thumbnail byte stream further according to index file, whether what directly can judge the current location records of index file according to the flag bit 00 or 01 of first character joint storage is invalid data, if valid data then determine whether which position in specifically thumbdata file, and according to the position acquisition thumbnail byte stream judged, if according to flag bit 00 judges that the current position of index file is invalid data, then need not determine whether that the next position that can jump to index file carries out judging, searching。The index search time can be saved by arranging the flag bit of a byte, improve and search speed and systematic function。
It is emphasized that, although some position being also required in the embodiment of the present invention in indexed file thumbindex is (such as, the position of the 1 to 26th) fill invalid data, but, owing in the application, every record of index file thumbindex only account for the memory space of 9 bytes and 9Byte, therefore, compared with the invalid data filling 10kb in thumbdata in the position of 1 to 26 direct with prior art, it is greatly saved memory space。Such as, assume there are 100,000 invalid datas, storage organization according to existing thumbdata file, the space waste of 100000*10kb=1GB will be had, and the method applying the present embodiment only has the space waste of 100000*9byte < 1M, both differences 1000 times, after being equivalent to the method for application the present embodiment, the average utilization of memory space improves 1000 times。
In Figure 5, step S54 is adding index file and is storing positional information to after index file, how utilizing index file to realize the lookup flow process of thumbnail byte stream。
Concrete, when receiving the thumbnail byte stream search request comprising unique ID, search index file according to unique ID, find the n-th position that unique ID is corresponding;Utilize the storage positional information of the thumbnail byte stream of the n-th location records found, obtain thumbnail byte stream and return。
Due in the present embodiment, when thumbnail byte stream is stored in thumbdata file, storage positional information recorded the n-th position corresponding for data base ID of this thumbnail byte stream in index file thumbindex, if so receiving search request, it is possible to directly according to the n-th position finding correspondence in the data base's unique ID indexed file in search request。Storage positional information according to this n-th location records can find thumbnail byte stream corresponding in thumbdata file。
Such as, referring to Fig. 7, determine the value of N according to data base ID, then the storage positional information according to the storage of second in n-th index item in index file to the 9th byte, this storage positional information is a hexadecimal number: 0000000000000014, calculates 4 × 16 °+1 × 161=20, it is known that this thumbnail byte stream is stored in the 20th position in thumbdata file。
Through above-mentioned steps, it is possible to search index file according to the data base ID of a pictures, and then thumbnail byte stream is found in the corresponding storage position in thumbdata file。
In order to save memory space further, in another embodiment of the present invention, in index file, every record can only take up the memory space of eight bytes, stores Long long data in the memory space of these eight bytes。Fig. 8 be another embodiment of the present invention index file in the structural representation of an entry index record, referring to Fig. 8 and Fig. 6 (Fig. 6 is the structural representation of the memory space that every record takies eight bytes in index file), in the present embodiment, in index file, each index item (i.e. every record) only accounts for the memory space of 8 bytes, such as, in Fig. 6, " 0000000000000001 " shown in the 27th position have recorded first position (1*16 in thumbdata file0=1), according to first position acquisition thumbnail byte stream in this positional information to thumbdata file, this is consistent with the information preserved in data base, demonstrates the accuracy of index search result。
The present embodiment, compared with the aforementioned index index entry taking 9 bytes, eliminates a byte shared by flag。So can improve the utilization rate of memory space further。
Additionally, one embodiment of the invention additionally provides a kind of thumbnail storage device based on android system, a kind of structure journey schematic diagram of the thumbnail storage device based on android system of Fig. 9 one embodiment of the invention, referring to Fig. 9, should include based on the thumbnail storage device 90 of android system:
Index file creation unit 901, for storing newly-built index file in the file belonging to file at thumbnail byte stream;
Thumbnail converting unit 902, for when increasing picture in the data base of android system newly, generating the thumbnail that newly-increased picture is corresponding, thumbnail be converted to thumbnail byte stream;
Memory element 903, for searching the tail position of thumbnail byte stream storage file, stores the tail position of thumbnail byte stream storage file by the thumbnail byte stream after conversion;
Index position record unit 904, for recorded the storage positional information of thumbnail byte stream in index file。
In one embodiment of the invention, index position record unit 904, specifically for utilizing newly-increased picture unique ID in the data base of android system, the storage positional information of thumbnail byte stream being recorded the n-th position in index file, wherein N is equal to unique ID;And, by before n-th position in index file and do not record thumbnail byte stream storage positional information position invalid data fill。
In one embodiment of the invention, device 90 also includes:
Index search unit, for when receiving the thumbnail byte stream search request comprising unique ID, searching index file according to unique ID, find the n-th position that unique ID is corresponding;
Utilize the storage positional information of the thumbnail byte stream of the n-th location records found, store at thumbnail byte stream and file obtains thumbnail byte stream and returns。
In one embodiment of the invention, in index file, every record takies the memory space of nine bytes, and wherein storage Byte byte type data in the memory space of first character joint, store Long long data in the memory space of the second to nine byte;Or, in index file, every record takies the memory space of eight bytes, stores Long long data in the memory space of these eight bytes。
In one embodiment of the invention, when in index file, every record takies the memory space of nine bytes, whether the data of the memory space saved by the first character in the memory space of nine bytes, as flag bit, store the storage positional information of thumbnail byte stream for this record of labelling;It is then, will indicate that what the memory space of in the memory space of nine bytes second to the 9th byte deposited is the storage positional information of thumbnail byte stream, otherwise, it was shown that what second in the memory space of nine bytes to the memory space of the 9th byte was deposited is invalid data。
It should be noted that, this work process based on the thumbnail storage device of android system in the present embodiment be with the aforesaid thumbnail storage method based on android system to realize step corresponding, therefore, the specific works process based on the thumbnail storage device of android system of the present embodiment may refer to the explanation of preceding method part, does not repeat them here。
In sum, this thumbnail storage method and apparatus based on android system of the embodiment of the present invention, add an index file thumbindex saving very much memory space, go again to search thumbnail byte stream corresponding in thumbnail byte stream storage file thumbdata file by index file thumbindex, it is all effective for making the data that in thumbdata file, all positions preserve, eliminate filling invalid data in thumbdata file, thus saving system memory space, improve memory space utilization rate and the performance of system。It addition, technical scheme is not when affecting lookup, drastically increase the utilization rate of android system device memory。Do not change Android simultaneously and adopt the mechanism of file sequence storage micro-thumbnail, compatibility test (CompatibilityTestSuite can be passed through, it is called for short CTS, compatibility test is Google's test for the standard interface of Android phone manufacturer, purpose is to ensure that the third party Android compatibility applied), thus can large-scale promotion produce, improve the competitiveness of Android device。
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit protection scope of the present invention。All make within the spirit and principles in the present invention any amendment, equivalent replacement, improvement etc., be all contained in protection scope of the present invention。
Claims (10)
1. the thumbnail storage method based on android system, it is characterised in that the method includes:
Newly-built index file in the file that thumbnail byte stream stores belonging to file;
In the data base of described android system during newly-increased picture, generate the thumbnail that described newly-increased picture is corresponding, described thumbnail is converted to thumbnail byte stream;
Search the tail position of described thumbnail byte stream storage file, the thumbnail byte stream after conversion is stored the tail position of described thumbnail byte stream storage file so that in described thumbnail byte stream storage file, the storage of each position is valid data;
The storage positional information of thumbnail byte stream be recorded in described index file。
2. method according to claim 1, it is characterised in that described the storage positional information of thumbnail byte stream be recorded described index file include:
Utilizing newly-increased picture unique ID in the data base of described android system, the storage positional information of thumbnail byte stream be recorded the n-th position in described index file, wherein N is equal to described unique ID;
And, by before n-th position in described index file and do not record thumbnail byte stream storage positional information position invalid data fill。
3. method according to claim 2, it is characterised in that the method farther includes:
When receiving the thumbnail byte stream search request comprising described unique ID, search described index file according to described unique ID, find the n-th position that described unique ID is corresponding;
Utilize the storage positional information of the thumbnail byte stream of the n-th location records found, store at described thumbnail byte stream and file obtains described thumbnail byte stream and returns。
4. method according to claim 2, it is characterized in that, in described index file, every record takies the memory space of nine bytes, and wherein storage Byte byte type data in the memory space of first character joint, store Long long data in the memory space of second to the 9th byte;
Or, in described index file, every record takies the memory space of eight bytes, stores Long long data in the memory space of these eight bytes。
5. method according to claim 4, it is characterized in that, when in described index file, every record takies the memory space of nine bytes, whether the data of the memory space saved by the first character in the memory space of described nine bytes, as flag bit, store the storage positional information of thumbnail byte stream for this record of labelling;It is then, show that what the memory space of in the memory space of nine bytes second to the 9th byte deposited is the storage positional information of described thumbnail byte stream, otherwise, it was shown that what second in the memory space of nine bytes to the memory space of the 9th byte was deposited is invalid data。
6. the thumbnail storage device based on android system, it is characterised in that this device includes:
Index file creation unit, for storing newly-built index file in the file belonging to file at thumbnail byte stream;
Thumbnail converting unit, for during newly-increased picture, generating the thumbnail that described newly-increased picture is corresponding, described thumbnail be converted to thumbnail byte stream in the data base of described android system;
Memory element, for searching the tail position of described thumbnail byte stream storage file, thumbnail byte stream after conversion is stored the tail position of described thumbnail byte stream storage file so that in described thumbnail byte stream storage file, the storage of each position is valid data;
Index position record unit, for recorded the storage positional information of thumbnail byte stream in described index file。
7. device according to claim 6, it is characterised in that
Described index position record unit, specifically for utilizing newly-increased picture unique ID in the data base of described android system, the storage positional information of thumbnail byte stream be recorded the n-th position in described index file, and wherein N is equal to described unique ID;
And, by before n-th position in described index file and do not record thumbnail byte stream storage positional information position invalid data fill。
8. device according to claim 6, it is characterised in that described device also includes:
Index search unit, for when receiving the thumbnail byte stream search request comprising described unique ID, searching described index file according to described unique ID, find the n-th position that described unique ID is corresponding;
Utilize the storage positional information of the thumbnail byte stream of the n-th location records found, store at described thumbnail byte stream and file obtains described thumbnail byte stream and returns。
9. device according to claim 6, it is characterized in that, in described index file, every record takies the memory space of nine bytes, and wherein storage Byte byte type data in the memory space of first character joint, store Long long data in the memory space of second to the 9th byte;
Or, in described index file, every record takies the memory space of eight bytes, stores Long long data in the memory space of these eight bytes。
10. device according to claim 9, it is characterised in that when every record takies the memory space of nine bytes in described index file,
Whether the data of the memory space saved by the first character in the memory space of described nine bytes, as flag bit, store the storage positional information of thumbnail byte stream for this record of labelling;It is then, will indicate that what the memory space of in the memory space of described nine bytes second to the 9th byte deposited is the storage positional information of described thumbnail byte stream, otherwise, it was shown that what second in the memory space of described nine bytes to the memory space of the 9th byte was deposited is invalid data。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511019283.5A CN105700825B (en) | 2015-12-29 | 2015-12-29 | A kind of thumbnail storage method and apparatus based on android system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511019283.5A CN105700825B (en) | 2015-12-29 | 2015-12-29 | A kind of thumbnail storage method and apparatus based on android system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105700825A true CN105700825A (en) | 2016-06-22 |
CN105700825B CN105700825B (en) | 2018-10-19 |
Family
ID=56226030
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201511019283.5A Active CN105700825B (en) | 2015-12-29 | 2015-12-29 | A kind of thumbnail storage method and apparatus based on android system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105700825B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111737210A (en) * | 2020-06-24 | 2020-10-02 | 深圳软牛科技有限公司 | Huashi mobile phone thumbnail extraction method and device and electronic equipment |
CN113407501A (en) * | 2021-06-29 | 2021-09-17 | 扬州能煜检测科技有限公司 | Image display and processing method, device and equipment for multiple second files |
WO2023142696A1 (en) * | 2022-01-29 | 2023-08-03 | 华为技术有限公司 | Thumbnail storage method and electronic device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1956090A (en) * | 2005-10-25 | 2007-05-02 | 索尼株式会社 | Electronic apparatus, playback management method, display control apparatus, and display control method |
US7580957B2 (en) * | 2006-01-31 | 2009-08-25 | Victor Company Of Japan, Limited | Structured data storage device and structured data storage method |
CN102455872A (en) * | 2010-10-14 | 2012-05-16 | Lg电子株式会社 | Mobile terminal and displaying method thereof |
-
2015
- 2015-12-29 CN CN201511019283.5A patent/CN105700825B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1956090A (en) * | 2005-10-25 | 2007-05-02 | 索尼株式会社 | Electronic apparatus, playback management method, display control apparatus, and display control method |
US7580957B2 (en) * | 2006-01-31 | 2009-08-25 | Victor Company Of Japan, Limited | Structured data storage device and structured data storage method |
CN102455872A (en) * | 2010-10-14 | 2012-05-16 | Lg电子株式会社 | Mobile terminal and displaying method thereof |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111737210A (en) * | 2020-06-24 | 2020-10-02 | 深圳软牛科技有限公司 | Huashi mobile phone thumbnail extraction method and device and electronic equipment |
CN113407501A (en) * | 2021-06-29 | 2021-09-17 | 扬州能煜检测科技有限公司 | Image display and processing method, device and equipment for multiple second files |
WO2023142696A1 (en) * | 2022-01-29 | 2023-08-03 | 华为技术有限公司 | Thumbnail storage method and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN105700825B (en) | 2018-10-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102508784B (en) | Data storage method of flash memory card in video monitoring equipment, and system thereof | |
CN101271463B (en) | Structure processing method and system of layout file | |
CN102073633A (en) | Method and device for storing and accessing resource file | |
CN104462029B (en) | The method and system that rich text is shown in a kind of intelligent terminal | |
CN103744621A (en) | Circular read-write method and device for buffer | |
CN101308488A (en) | Document streaming information processing method and device based on format file | |
CN102662928A (en) | Rich text editing method for importing documents and device thereof | |
CN111159594A (en) | Information processing method, information processing device and terminal equipment | |
CN111950247A (en) | Configuration-based Word document generation method | |
CN101295332A (en) | DICOM file patient information anonymization processing method | |
CN105700825A (en) | Thumbnail storage method and device based on Android system | |
CN104281601A (en) | Method and device for constructing huge character library and method and device for displaying characters | |
CN103389945B (en) | Memory management method and device | |
US6956970B2 (en) | Information storage using tables and scope indices | |
CN1588352A (en) | Recording method for extendable mark language file repairing trace | |
CN103034734A (en) | File storage and inquiry agency and information searching method and system | |
CN101777077B (en) | Method for implementing file system of embedded device | |
WO2017096521A1 (en) | Method and apparatus for extending user partition | |
US20240264931A1 (en) | Storage optimization method and apparatus for distributed storage system | |
CN104424224A (en) | File index storage method and device | |
CN102075572B (en) | Embedded type web server | |
CN112328594B (en) | Embedded device model data management method and device | |
CN102270194B (en) | Character processing method and device | |
CN103488440A (en) | Bill printing device and bill printing method | |
CN101369953A (en) | Method and system for network distribution of fonts |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |