[go: up one dir, main page]

CN105700825B - A kind of thumbnail storage method and apparatus based on android system - Google Patents

A kind of thumbnail storage method and apparatus based on android system Download PDF

Info

Publication number
CN105700825B
CN105700825B CN201511019283.5A CN201511019283A CN105700825B CN 105700825 B CN105700825 B CN 105700825B CN 201511019283 A CN201511019283 A CN 201511019283A CN 105700825 B CN105700825 B CN 105700825B
Authority
CN
China
Prior art keywords
thumbnail
storage
byte stream
file
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.)
Active
Application number
CN201511019283.5A
Other languages
Chinese (zh)
Other versions
CN105700825A (en
Inventor
秦文东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Goertek Techology Co Ltd
Original Assignee
Goertek Techology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Goertek Techology Co Ltd filed Critical Goertek Techology Co Ltd
Priority to CN201511019283.5A priority Critical patent/CN105700825B/en
Publication of CN105700825A publication Critical patent/CN105700825A/en
Application granted granted Critical
Publication of CN105700825B publication Critical patent/CN105700825B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management 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 present invention discloses a kind of thumbnail storage method and apparatus based on android system, and this method includes:Index file is created in file belonging to thumbnail byte stream storage file;When increasing picture in the database of android system newly, generates and increase the corresponding thumbnail of picture newly, thumbnail is converted into thumbnail byte stream;The tail position for searching thumbnail byte stream storage file, by the tail position of transformed thumbnail byte stream storage to thumbnail byte stream storage file;The storage location information of thumbnail byte stream is recorded in index file.Technical solution of the present invention is by increasing index file, and the storage location information of thumbnail byte stream is recorded in the index file, allow to search thumbnail according to index file, and each position stores valid data in thumbnail byte stream storage file, it solves the problems, such as memory space serious waste when android system stores thumbnail, saves memory space.

Description

A kind of thumbnail storage method and apparatus based on android system
Technical field
The present invention relates to android system technical fields, and in particular to a kind of thumbnail storage based on android system Method and apparatus.
Background technology
Android (Chinese name, Android) system, is a mobile device operation system increased income based on Linux, It is mainly used in the intelligent terminals such as smart mobile phone and tablet computer.Android system uses SQLite data base administrations Local file, SQLite are a light-duty, relevant databases.
Fig. 1 is flow diagram of the Android device to local data management.Referring to the step S11 in Fig. 1 to step S15;Step S11 increases a file → step S12 newly, this document is inserted into database → step S13, judges that this document is It is no for picture → be then, execute step S14 by the common thumbnail of thread creation (otherwise, terminating flow) → step S15, pass through Thread creation micro-thumbnail.For example, when be mounted with the mobile phone of android system by taking pictures or other modes have increased one newly When pictures, system can create thread and generate two kinds of thumbnails, and one is relatively large sized common thumbnails to correspond to step S14;Another kind be miniature thumbnail correspond to step S15 (present invention is the improvement to this micro-thumbnail storage scheme, The thumbnail hereinafter occurred refers to this micro-thumbnail).The purposes of the micro-thumbnail generated in step S15 is very extensive. For example, being used in a newest figure for the interface display of taking pictures of the camera in Android phone, or take pictures in third party soft It is used when the picture of reduced sizes such as user's head portrait in part picture mosaic, and setting immediate communication tool.
Android system, will when storing micro-thumbnail in order to reduce the fragmentation of file and improve access speed These micro-thumbnails are converted into thumbnail byte stream, are saved under the paths DCIM/Camera/.thumnail/thumbdata Thumbnail byte stream storage file (i.e. thumbdata files) in, and sort according to the corresponding database ID of thumbnail.Fig. 2 It is database fragment schematic diagrames of the ID from 18 to 28 in the Android local data bases opened by SQLite visualization tools, Fig. 3 is the data store organisation schematic diagram of thumbdata files, as shown in Fig. 2, data file exists in existing android system The unique ID that the local data library storage time-division is fitted on is continuous and incremental, and what the position that ID is 27 and 28 recorded is picture Information.Referring to Fig. 3, in order to ensure can directly to find corresponding contracting according to the ID of the corresponding picture of thumbnail in the database Position of the sketch map byte stream in thumbdata files.It is in ID only when android system stores in thumbdata files Valid data are preserved in 27 and 28 corresponding positions, and what thumbdata files corresponded to the position preservation that ID is 1 to 26 is nothing Imitate data (i.e. cover data).Each thumbnail byte stream occupies the memory space of 10kb in thumbdata files, in this way The position for not storing thumbnail byte stream in thumbdata files needs to use the 0x00 polishings of 10kb.It follows that this storage Mode results in many positions in thumbdata files and needs invalid data 0x00 covers, causes the very big wave of memory space Take.
For example, as an only pictures A in an Android phone, and the ID that picture A is distributed in the local database is When 100000, the size of thumbdata files is then 100000*10kb=1GB.If opening this 1GB with super editing machine Thumbnail byte stream storage file, it will be seen that invalid data as a large amount of " 00 00 00 00 00 ... ", and significant figure It is a little according to only accounting for.In fact, thumbdata file sizes depend on a newest pictures under this memory module Corresponding database ID, even if only storing a pictures in local data base, and the corresponding database ID of the picture is 10000, then the position of preceding 99999*10kb is all invalid data in thumbdata files, only the last one position is deposited Thumbnail byte stream has been stored up (what is stored is valid data).
Especially in Android in order to ensure the uniqueness and database security of each database ID corresponding datas, data ID in library is continually incremented and not under the premise of reusable.ID is once previously used, even if data are deleted, ID will not It reuses.In this way, when an Android phone uses the several months, the ID in database averagely can reach 100000 or more.It is very bright Aobvious, thumbnail storage scheme causes the serious waste of memory space in existing android system, it would be highly desirable to solve.
Invention content
The thumbnail storage method and apparatus based on android system that the present invention provides a kind of, it is existing to solve In android system caused by thumbnail storage scheme the problem of memory space serious waste.
According to an aspect of the invention, there is provided a kind of thumbnail storage method based on android system, this method Including:
Index file is created in file belonging to thumbnail byte stream storage file;
It when increasing picture in the database of android system newly, generates and increases the corresponding thumbnail of picture newly, thumbnail is turned It is changed to thumbnail byte stream;
The tail position for searching thumbnail byte stream storage file, by transformed thumbnail byte stream storage to thumbnail The tail position of byte stream storage file so that each position storage is significant figure in thumbnail byte stream storage file According to;
The storage location information of thumbnail byte stream is recorded in index file.
Optionally, index file is recorded in the storage location information of thumbnail byte stream includes:
Using unique ID of the newly-increased picture in the database of android system, by the storage of thumbnail byte stream The n-th position in index file is recorded in location information, and wherein N is equal to unique ID;And by N in index file It is filled with invalid data before a position and position of the storage location information without recording thumbnail byte stream.
Optionally, this method further comprises:
When receiving the thumbnail byte stream search request comprising unique ID, is searched and indexed according to unique ID File finds the corresponding n-th position of unique ID;
Using the storage location information of the thumbnail byte stream of the n-th position record found, in the thumbnail word Thumbnail byte stream is obtained in throttling storage file and is returned.
Optionally, every memory space for recording nine bytes of occupancy, the wherein storage of first character section in index file Byte byte type data are stored in space, and Long signless long datas are stored in the memory space of second to the 9th byte;
Alternatively, every record occupies the memory space of eight bytes in index file, in the memory space of eight bytes Store Long signless long datas.
Optionally, when every record occupies the memory space of nine bytes in index file, by the storage of nine bytes The data of the memory space of first character section in space are as flag bit, for marking whether this record stores thumbnail The storage location information of byte stream;It is then to show that the storage of second to the 9th byte in the memory space of nine bytes is empty Between store is otherwise the storage location information of thumbnail byte stream shows second in the memory space of nine bytes The memory space storage of nine bytes is invalid data.
According to another aspect of the present invention, a kind of thumbnail storage device based on android system, the dress are provided Set including:
Index file creation unit, for newly indexing text in the file belonging to thumbnail byte stream storage file Part;
Thumbnail converting unit increases picture correspondence newly for when increasing picture in the database of android system newly, generating Thumbnail, thumbnail is converted into thumbnail byte stream;
Storage unit, the tail position for searching thumbnail byte stream storage file, by transformed thumbnail byte Tail position of the stream storage to thumbnail byte stream storage file so that each position storage in thumbnail byte stream storage file Be all valid data;
Index position recording unit, for the storage location information of thumbnail byte stream to be recorded in index file.
Optionally, index position recording unit is specifically used for using newly-increased picture in the database of android system The n-th position in index file is recorded in the storage location information of thumbnail byte stream by unique ID, and wherein N is equal to Unique ID;And it will be before n-th position in index file and without the storage location information of record thumbnail byte stream Position filled with invalid data.
Optionally, device further includes:
Index search unit, for when receiving the thumbnail byte stream search request comprising unique ID, according to Unique ID searches index file, finds the corresponding n-th position of unique ID;
Using the storage location information of the thumbnail byte stream of the n-th position record found, in thumbnail byte stream Thumbnail byte stream is obtained in storage file and is returned.
Optionally, every memory space for recording nine bytes of occupancy, the wherein storage of first character section in index file Byte byte type data are stored in space, and Long signless long datas are stored in the memory space of the second to nine byte;Alternatively, rope Every record occupies the memory space of eight bytes in quotation part, and Long long numbers are stored in the memory space of eight bytes According to.
Optionally, when every record occupies the memory space of nine bytes in index file, by the storage of nine bytes The data of the memory space of first character section in space are as flag bit, for marking whether this record stores thumbnail The storage location information of byte stream;It is then to show that the storage of second to the 9th byte in the memory space of nine bytes is empty Between store is otherwise the storage location information of thumbnail byte stream shows second in the memory space of nine bytes The memory space storage of nine bytes is invalid data.
The beneficial effects of the invention are as follows:Compared with the existing storage scheme of android system, the technical side of the embodiment of the present invention By increasing an index file for saving very much memory space the increase is recorded in the storage location of thumbnail byte stream by case Index file in, subsequently through the storage location information recorded in index file again go search thumbnail byte stream storage file The actual location of middle thumbnail byte stream.In this way, by changing the storage mode according to the corresponding database ID of picture so that contracting What all positions preserved in sketch map byte stream storage file is all valid data, and the filling of invalid data is omitted, solves When android system stores thumbnail the problem of memory space serious waste, system memory space is saved, data is improved and looks into Look for speed and system performance.
Description of the drawings
Fig. 1 is flow diagram of the Android device to local data management;
Fig. 2 is the database piece of the Android local data bases ID that is opened by SQLite visualization tools from 18 to 28 Section schematic diagram;
Fig. 3 is the data store organisation schematic diagram of thumbdata files;
Fig. 4 is a kind of flow signal of thumbnail storage method based on android system of one embodiment of the invention Figure;
Fig. 5 be using one embodiment of the invention it is a kind of based on android system thumbnail storage method storage and The flow diagram of lookup;
Fig. 6 is the storage organization and two of the index file and thumbnail byte stream storage file of one embodiment of the invention The schematic diagram of person's correspondence;
Fig. 7 be one embodiment of the invention index file in an entry index record structural schematic diagram;
Fig. 8 be another embodiment of the present invention index file in an entry index record structural schematic diagram;
A kind of structure journey of thumbnail storage device based on android system of Fig. 9 one embodiment of the invention is illustrated Figure.
Specific implementation mode
Core of the invention thought is:According to thumbnail pair when storing thumbnail for android system in the prior art When the ID of the picture answered in the local database is stored, needing (can be according to breviary with guarantee with a large amount of invalid data occupy-place Scheme the ID of corresponding picture in the database and directly find position of the thumbnail byte stream in thumbdata files), greatly The problem of wasting memory space, pass through increase by one very save memory space index file thumbindex, utilize Index file thumbindex removes to search again the thumbnail byte stream in thumbnail byte stream storage file thumbdata, makes It is all effective to obtain the data that all positions preserve in thumbdata files, and filling invalid data is omitted to thumbdata texts Space waste caused by part, to save system memory space.
Fig. 4 is a kind of flow signal of thumbnail storage method based on android system of one embodiment of the invention Figure, referring to Fig. 4, the thumbnail storage method based on android system of being somebody's turn to do includes the following steps:
Step S41 creates index file in the file belonging to thumbnail byte stream storage file;
It is corresponding to generate the newly-increased picture when increasing picture in the database of the android system newly by step S42 The thumbnail is converted to thumbnail byte stream by thumbnail;
Step S43 searches the tail position of the thumbnail byte stream storage file, by transformed thumbnail byte stream Store the tail position of the thumbnail byte stream storage file so that each position is deposited in thumbnail byte stream storage file Storage is all valid data;
The storage location information of thumbnail byte stream is recorded in the index file step S44.
By step shown in Fig. 4, the thumbnail storage method of the android system of the embodiment of the present invention passes through in breviary Index file is created in file belonging to figure byte stream storage file, and when newly-increased breviary in thumbnail byte stream storage file When figure byte stream, corresponding position in the index file is recorded in the storage location information that this is increased newly to byte stream, in this way, subsequently may be used To go thumbnail byte stream storage file according to the index record lookup of corresponding position in index file, thumbnail byte is obtained Stream.In this way, valid data as thumbnail byte stream can be only deposited in thumbnail byte stream storage file, without filling Invalid data occupy-place, to save memory space.
It should be noted that in the present embodiment, the valid data in index file refer to indicating thumbnail byte stream to exist The data of location information in thumbnail byte stream storage file, and invalid data is then not indicate that thumbnail byte stream is contracting The data of location information in sketch map byte stream storage file, in the present embodiment, invalid data is indicated with 0 in index file. Valid data in thumbnail byte stream storage file refer to thumbnail byte stream, and invalid data is indicated with 0.
Fig. 5 be using one embodiment of the invention it is a kind of based on android system thumbnail storage method storage and The flow diagram of lookup, Fig. 6 are the storages of the index file and thumbnail byte stream storage file of one embodiment of the invention The schematic diagram of structure and the two correspondence, Fig. 7 be one embodiment of the invention index file in an entry index record Structural schematic diagram;Below in conjunction with Fig. 5 to Fig. 7 to this thumbnail storage method based on android system of the present embodiment Realize that step is described in detail.
In Figure 5, step S51 to step S53 is the Stored Procedure of thumbnail byte stream after increasing index file. Referring to Fig. 5, step S51, the position of thumbdata file most ends is searched.
Here it is to have increased a pictures (including photo) newly in android system database and database is assigned ID is converted into thumbnail byte stream and waits for when being saved in thumbnail byte stream storage file (i.e. thumbdata files), needs The position of thumbdata file most ends is searched so that the position is arrived in the corresponding thumbnail byte stream storage of newly-increased picture.It needs It is noted that it is the prior art to generate the newly-increased corresponding thumbnail of picture and thumbnail is converted to thumbnail byte stream, it can To be realized using prior art means, which is not described herein again.
Thumbnail byte stream is stored to thumbdata file most ends by step S52 after finding the position of most end Position, and corresponding position in index file thumbindex is recorded in this location information, it will be invalid before the position Position is determined with 0 filling occupy-place, here corresponding position by the corresponding database ID of the thumbnail byte stream.
Specifically, directly taking the big of thumbdata files by File.length () function of Java in the present embodiment Small (length) obtains the position of thumbdata end of file.Since the size of every record in thumbdata files is 10kb, the data header of the 10Kb data include the real length information of this thumbnail byte stream, when passing through File.length When () function obtains the length of current thumbdata files, you can obtain the position of thumbdata file most ends.
Referring to Fig. 6,61 expressions are index file (thumbindex files), and 62 indicate the storage text of thumbnail byte streams Part (i.e. thumbdata files).In the present embodiment, the storage location information of thumbnail byte stream is recorded in index file Including:Using unique ID of the newly-increased picture in the database of android system, by the storage location of thumbnail byte stream N-th position in index file is recorded in information, and N is equal to unique ID;And it will be before n-th position in index file And the position without recording thumbnail byte stream storage location information is filled with invalid data.
Specifically, in conjunction with Fig. 2, for example, the ID that currently newly-increased picture distributes in the database is 27 (assuming that ID is 27 Picture is the first pictures in database), in storage, system generates the thumbnail of the newly-increased picture, and by the thumbnail Be converted to thumbnail byte stream.Take the position of thumbdata file most ends (due at this moment by File.length () function Thumbdata files storage thumbnail byte stream not yet, so the position of most end is first position) by the thumbnail Byte stream is stored in first position of thumbdata files, and thumbindex then is recorded in the information of first position Corresponding position in index file.
Referring to Fig. 6, in the present embodiment, since the thumbnail byte stream of first position of thumbdata files corresponds to number It is 27 according to the unique ID in library, so according to the unique ID by thumbdata file thumbnail words when specific storage The 27th position of index file is recorded in the storage location information (i.e. first position) of throttling.The serial number on 61 left side of index file " 1,2,3 ... N " indicates the unique ID in sequence of positions correspondence database, that is to say, that index file thumbindex In record be also to store in order, this sequence is exactly the ID that newly-increased picture distributes in the database.As shown in Figure 2, exist In database ID be 1 to 26 corresponding positions storages be not picture thus in indexed file the 1st to 26 position needs It is filled with invalid data, can ensure the corresponding position for searching index file according to the ID in database in this way, further according to index The location information that corresponding position stores in file is to find the thumbnail byte stream in thumbdata files.
Referring to Fig. 7, in the present embodiment, every record occupies the memory space of nine bytes in index file, wherein first What is stored in the memory space 71 of a byte is Byte byte type data, is stored in the memory space 72 of the second to nine byte It is Long signless long datas, in the present embodiment, by the memory space 71 of the first character section in the memory space of nine bytes In data as flag bit, for marking whether this record stores the storage location information of thumbnail byte stream;Be then, Show the storage of memory space 72 of second to the 9th byte in the memory space of nine bytes is thumbnail byte stream Otherwise storage location information shows the memory space storage of second to the 9th byte in the memory space of nine bytes It is invalid data.
Specifically, referring to Fig. 6, in the present embodiment, the storage that every record in index file 61 occupies nine bytes is empty Between, the storage of first character section is Byte type data, wherein indicating flag bit with 00 and 01, is marked whether as significance bit, data 00 is set as invalid bit, and data 01 are set as significance bit.For example, the 27th position in index file stores thumbnail word After valid data as the location information to throttle in thumbdata, step S53 is executed, by nine words of the 27th position The data of first character section in the memory space of section are set to 01, and indicate position record is that (what is recorded is valid data Storage location of the thumbnail byte stream in thumbdata).It can default setting in first indexed file during concrete application The flag bit of all records is 00, and valid data are stored in the memory space of the second to the 9th byte only in the position Afterwards, the value of the first character section Byte of the position is set as 01, show to store in index file with this is valid data.
It, can be directly according to the mark of first character section storage when searching thumbnail byte stream further according to index file in this way Whether what position 00 or 01 judged the current position record of index file is invalid data, then further judges have if valid data Body is where thumbdata files, and according to the position acquisition thumbnail byte stream judged, if according to mark Position 00 judges that the current position of index file is invalid data, then need not further judge jump under index file One position is judged, is searched.Flag bit by the way that a byte is arranged can save the index search time, improve and search speed Degree and system performance.
Although it is emphasized that being also required to certain positions in indexed file thumbindex in the embodiment of the present invention (for example, the 1 to 26th position) fills invalid data, still, due to every note of index file thumbindex in the application Record only accounts for the 9 bytes i.e. memory space of 9Byte, therefore, and in the prior art directly in thumbdata 1 to 26 The invalid data of position filling 10kb is compared, and memory space is greatly saved.For example, it is assumed that there are 100,000 invalid datas, press According to the storage organization of existing thumbdata files, it will have the space waste of 100000*10kb=1GB, and apply this implementation The method of example only has 100000*9byte<The space waste of 1M, the two differ 1000 times, are equivalent to the method using the present embodiment Afterwards, the average utilization of memory space improves 1000 times.
In Figure 5, step S54 be after increasing index file and storing location information to index file, how profit Index of reference file realizes the lookup flow of thumbnail byte stream.
Specifically, when receiving the thumbnail byte stream search request comprising unique ID, according to unique ID Index file is searched, the corresponding n-th position of unique ID is found;Utilize the thumbnail of the n-th position record found The storage location information of byte stream obtains thumbnail byte stream and returns.
By in this present embodiment, when by the storage to thumbdata files of thumbnail byte stream, storage location is believed The corresponding n-th positions database ID of the thumbnail byte stream in index file thumbindex have been recorded in breath, so such as Fruit receives search request, directly can find correspondence according in the database unique ID indexed file in search request N-th position.The storage location information recorded according to the n-th position can find corresponding in thumbdata files Thumbnail byte stream.
For example, with reference to Fig. 7, the value of N is determined according to database ID, then according in index file n-th index Second to the 9th byte storage storage location information, which is a hexadecimal number:00 00 00 00 00 00 00 14, calculate 4 × 16 °+1 × 161=20, it is known that the thumbnail byte stream is stored in thumbdata files In the 20th position.
By above-mentioned steps, index file can be searched according to the database ID of a pictures, and then in thumbdata texts Corresponding storage location in part finds thumbnail byte stream.
In order to further save memory space, in another embodiment of the present invention, every record can in index file To only take up the memory space of eight bytes, Long signless long datas are stored in the memory space of eight bytes.Fig. 8 is this hair The structural schematic diagram that an entry index records in the index file of another bright embodiment, referring to Fig. 8 and Fig. 6, (Fig. 6 is index file In every record occupy eight bytes memory space structural representation), in the present embodiment, each index in index file (i.e. every record) only accounts for the memory space of 8 bytes, for example, in Fig. 6 shown in the 27th position " 00 00 00 00 0000 00 01 " first position (1*16 in thumbdata files is had recorded0=1) it, is arrived according to this location information First position acquisition thumbnail byte stream in thumbdata files, this is consistent with the information preserved in database, demonstrates The accuracy of index search result.
A word shared by flag is omitted compared with the aforementioned index index entries for occupying 9 bytes in the present embodiment Section.The utilization rate of memory space can be further increased in this way.
In addition, one embodiment of the invention additionally provides a kind of thumbnail storage device based on android system, Fig. 9 A kind of structure journey schematic diagram of thumbnail storage device based on android system of one embodiment of the invention, referring to Fig. 9, The thumbnail storage device 90 based on android system includes:
Index file creation unit 901, for newly being indexed in the file belonging to thumbnail byte stream storage file File;
Thumbnail converting unit 902, for when increasing picture in the database of android system newly, generating and increasing picture newly Thumbnail is converted to thumbnail byte stream by corresponding thumbnail;
Storage unit 903, the tail position for searching thumbnail byte stream storage file, by transformed thumbnail word Tail position of the throttling storage to thumbnail byte stream storage file;
Index position recording unit 904, for the storage location information of thumbnail byte stream to be recorded in index file.
In one embodiment of the invention, index position recording unit 904 is specifically used for existing using newly-increased picture Index file is recorded in the storage location information of thumbnail byte stream by the unique ID in the database of android system In n-th position, wherein N be equal to unique ID;And it will be before n-th position in index file and without record contracting It is filled with invalid data the position of sketch map byte stream storage location information.
In one embodiment of the invention, device 90 further includes:
Index search unit, for when receiving the thumbnail byte stream search request comprising unique ID, according to Unique ID searches index file, finds the corresponding n-th position of unique ID;
Using the storage location information of the thumbnail byte stream of the n-th position record found, in thumbnail byte stream Thumbnail byte stream is obtained in storage file and is returned.
In one embodiment of the invention, every memory space for recording nine bytes of occupancy in index file, wherein Byte byte type data are stored in the memory space of first character section, and Long long is stored in the memory space of the second to nine byte Integer data;Alternatively, every record occupies the memory space of eight bytes in index file, in the memory space of eight bytes Store Long signless long datas.
In one embodiment of the invention, when every record occupies the memory space of nine bytes in index file, Using the data of the memory space of the first character section in the memory space of nine bytes as flag bit, for marking this to record Whether the storage location information of thumbnail byte stream is stored;Be then, will indicate that in the memory space of nine bytes second to The memory space storage of 9th byte is otherwise the storage location information of thumbnail byte stream shows depositing for nine bytes The memory space storage for storing up second to the 9th byte in space is invalid data.
It should be noted that this thumbnail storage device based on android system in the present embodiment is worked Journey be it is corresponding with the realization step of the thumbnail storage method above-mentioned based on android system, therefore, the present embodiment The specific work process of thumbnail storage device based on android system may refer to the explanation of preceding method part, herein It repeats no more.
In conclusion this thumbnail storage method and apparatus based on android system of the embodiment of the present invention, increase One index file thumbindex for saving very much memory space goes again by index file thumbindex to search breviary Corresponding thumbnail byte stream in figure byte stream storage file thumbdata files so that all positions in thumbdata files The data of preservation are all effective, are omitted in filling invalid data to thumbdata files, empty to save system storage Between, improve the memory space utilization rate and performance of system.In addition, technical scheme of the present invention is not the case where influencing to search Under, greatly improve the utilization rate of android system device memory.Simultaneously file sequence is used without changing Android The mechanism of row storage micro-thumbnail, can by compatibility test (Compatibility Test Suite, abbreviation CTS, it is simultaneous Capacitive test is test of the Google for the standard interface of Android phone manufacturer, it is therefore an objective to ensure third party's Android applications Compatibility), thus can be produced with large-scale promotion, improve the competitiveness of Android device.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (10)

1. a kind of thumbnail storage method based on android system, which is characterized in that this method includes:
Index file is created in file belonging to thumbnail byte stream storage file;
When increasing picture in the database of the android system newly, the corresponding thumbnail of the newly-increased picture is generated, it will be described Thumbnail is converted to thumbnail byte stream;
The tail position for searching thumbnail byte stream storage file, by transformed thumbnail byte stream storage to the thumbnail The tail position of byte stream storage file so that each position storage is effective in the thumbnail byte stream storage file Data;
The storage location information of thumbnail byte stream is recorded in the index file.
2. according to the method described in claim 1, it is characterized in that, the storage location information by thumbnail byte stream records Include to the index file:
Using unique ID of the newly-increased picture in the database of the android system, by the storage of thumbnail byte stream The n-th position in the index file is recorded in location information, and wherein N is positive integer and the value of N is equal to the unique mark ID;
And it will be before n-th position in the index file and without the storage location information of record thumbnail byte stream It is filled with invalid data position.
3. according to the method described in claim 2, it is characterized in that, this method further comprises:
When receiving the thumbnail byte stream search request comprising the unique ID, searched according to the unique ID The index file finds the corresponding n-th position of the unique ID;
Using the storage location information of the thumbnail byte stream of the n-th position record found, in the thumbnail byte stream The thumbnail byte stream is obtained in storage file and is returned.
4. according to the method described in claim 2, it is characterized in that, every record occupies nine bytes in the index file Memory space stores Byte byte type data, the storage of second to the 9th byte wherein in the memory space of first character section Long signless long datas are stored in space;
Alternatively, every record occupies the memory space of eight bytes in the index file, in the memory space of eight bytes Store Long signless long datas.
5. according to the method described in claim 4, it is characterized in that, when every record nine bytes of occupancy in the index file Memory space when, using the data of the memory space of the first character section in the memory space of nine bytes as mark Position, for marking whether this record stores the storage location information of thumbnail byte stream;It is then, to show depositing for nine bytes What the memory space of second to the 9th byte in storage space was stored is the storage location information of the thumbnail byte stream, no Then, show the memory space storage of second to the 9th byte in the memory space of nine bytes is invalid data.
6. a kind of thumbnail storage device based on android system, which is characterized in that the device includes:
Index file creation unit, for creating index file in the file belonging to thumbnail byte stream storage file;
Thumbnail converting unit, for when increasing picture in the database of the android system newly, generating the newly-increased picture The thumbnail is converted to thumbnail byte stream by corresponding thumbnail;
Storage unit, the tail position for searching thumbnail byte stream storage file deposit transformed thumbnail byte stream Store up the tail position of the thumbnail byte stream storage file so that each position in the thumbnail byte stream storage file Storage is all valid data;
Index position recording unit, for the storage location information of thumbnail byte stream to be recorded in the index file.
7. device according to claim 6, which is characterized in that
The index position recording unit, be specifically used for using increase newly picture in the database of the android system only One mark ID, is recorded the n-th position in the index file, wherein N is by the storage location information of thumbnail byte stream Positive integer and the value of N are equal to the unique ID;
And it will be before n-th position in the index file and without the storage location information of record thumbnail byte stream It is filled with invalid data position.
8. device according to claim 6, which is characterized in that described device further includes:
Index search unit, for when receiving the thumbnail byte stream search request comprising unique ID, according to described Unique ID searches the index file, finds the corresponding n-th position of the unique ID, and wherein N is positive integer and N Value be equal to the unique ID;
Using the storage location information of the thumbnail byte stream of the n-th position record found, in the thumbnail byte stream The thumbnail byte stream is obtained in storage file and is returned.
9. device according to claim 6, which is characterized in that every records nine bytes of occupancy in the index file Memory space stores Byte byte type data, the storage of second to the 9th byte wherein in the memory space of first character section Long signless long datas are stored in space;
Alternatively, every record occupies the memory space of eight bytes in the index file, in the memory space of eight bytes Store Long signless long datas.
10. device according to claim 9, which is characterized in that when every record occupies nine words in the index file When the memory space of section,
Using the data of the memory space of the first character section in the memory space of nine bytes as flag bit, for marking This records the storage location information for whether storing thumbnail byte stream;It is that then will indicate that the storage of nine bytes is empty Between in second to the 9th byte memory space storage be the thumbnail byte stream storage location information, otherwise, Show the memory space storage of second to the 9th byte in the memory space of nine bytes is invalid data.
CN201511019283.5A 2015-12-29 2015-12-29 A kind of thumbnail storage method and apparatus based on android system Active CN105700825B (en)

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 CN105700825A (en) 2016-06-22
CN105700825B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111737210B (en) * 2020-06-24 2024-07-26 深圳软牛科技有限公司 Method and device for extracting thumbnail of Huacheng mobile phone and electronic equipment
CN113407501A (en) * 2021-06-29 2021-09-17 扬州能煜检测科技有限公司 Image display and processing method, device and equipment for multiple second files
CN116561351A (en) * 2022-01-29 2023-08-08 华为技术有限公司 Thumbnail storage method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
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

Also Published As

Publication number Publication date
CN105700825A (en) 2016-06-22

Similar Documents

Publication Publication Date Title
CN106096023B (en) Method for reading data, method for writing data and data server
US20120265776A1 (en) Method and System for Creating Linked List, Method and System for Searching Data
US8271544B2 (en) Data file having more than one mode of operation
US20170063695A1 (en) Full flow retrieval optimized packet capture
US6928460B2 (en) Method and apparatus for performing generational garbage collection in a segmented heap
JP5152877B2 (en) Document data storage method and apparatus in document base system
US20050147300A1 (en) Serial storage of ink and its properties
US7634517B1 (en) System and method for dynamically updating a document repository without interrupting concurrent querying
CN109542857B (en) Audit log storage method, audit log query method, audit log storage device, audit log query device and related equipment
JP2000194590A (en) Extension card file system
CN105700825B (en) A kind of thumbnail storage method and apparatus based on android system
US7265854B1 (en) Method and apparatus for managing complex presentation objects using globally-unique identifiers
CN111950247A (en) Configuration-based Word document generation method
CN104281601A (en) Method and device for constructing huge character library and method and device for displaying characters
CN109522405A (en) File information processing method, electronic equipment and computer-readable deposit medium
CN104951482B (en) A kind of method and device of the image file of operation Sparse formats
WO2007125518A2 (en) Commands for the handling of large files
CN114880138A (en) High-performance data model access method and device based on shared memory pool
US7028287B2 (en) Method and apparatus for facilitating compact object headers
CN106934066B (en) Metadata processing method and device and storage equipment
CN101777077A (en) Method for implementing file system of embedded device
TW508926B (en) Method and system for efficient routing table compression and fast routing lookups
USRE43301E1 (en) Method and apparatus for an improved stack arrangement and operations thereon
US20120192046A1 (en) Generation of a source complex document to facilitate content access in complex document creation
CN1430148A (en) Method of storing and accessing embedded database

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