Specific implementation mode
To better understand the objects, features and advantages of the present invention, below in conjunction with the accompanying drawings and specific real
Mode is applied the present invention is further described in detail.It should be noted that in the absence of conflict, the implementation of the application
Feature in example and embodiment can be combined with each other.
Many details are elaborated in the following description to facilitate a thorough understanding of the present invention, still, the present invention may be used also
To be implemented different from other modes described here using other, therefore, the present invention is not limited to following public specific realities
Apply the limitation of example.
Fig. 1 shows the block diagram of document data download apparatus according to an embodiment of the invention.
As shown in Figure 1, document data download apparatus 100 according to an embodiment of the invention, may include:Data to be downloaded
Block determination unit 102, according to the download base unit size of data block, determines described in downloading for receiving document data request
The quantity of data block to be downloaded needed for document data, and according to pre-defined rule, determine the downloading order of data block to be downloaded
And download state;Download unit 104 is used to, according to the downloading order and download state, download each data block to be downloaded, and
For each data block, the data block completed will be downloaded and be supplied to terminal.
The download base unit size of the data block can according to user need be configured, when each browsing content of user compared with
When more, it can will download base unit and be dimensioned to higher value, similarly, when each browsing content of user is less, can will download
Base unit is dimensioned to smaller value.This article file data can be structured document, such as word, CEBX(Common e-
Document of Blending XML, the common electronic document based on mixing XML), the formats such as PDF document.In this implementation
In example, required data block is downloaded according to predetermined downloading order, it can be according to the reading rate of user or other requirements
Data block needed for downloading realizes the function of being read when downloading, only needs the data block browsed to be supplied to user user,
Browse efficiency is not only increased, data traffic is decreased.
Above-mentioned preset rules can be formulated as needed, for example, the data block to be downloaded can be based in the document
Sequence of positions in data, establishes list to be downloaded, and the list to be downloaded is used to record the downloading order of data block to be downloaded
And download state;The sequence of data block to be downloaded can also be arranged in the preset rules acording to the requirement of user, it is assumed that a document
Data include picture and word, then can first download word, then download pictures, or can also first download pictures, then under
Published article word;The quantity of downloading data block simultaneously can also be arranged in the preset rules according to the size of the quantity of data block, for example, can
First to download two data blocks simultaneously, three data blocks are then downloaded simultaneously, is so incremented by, can alleviate initial download pressure in this way
Power, and can equally improve download efficiency.
In the above-mentioned technical solutions, it is preferred that the download unit 104 is additionally operable to when receiving jump browse request,
It is preferential to download specified data block corresponding with the jump browse request.In some scenarios, user is not to browse in order
Document content, only select certain part to be read, the present invention can provide the function of jump browsing, directly jump is downloaded
User's specified data block, solves the technical issues of on-demand download.If user exits reader, just do not have to download not
Download the data block completed, while saving data traffic for user, also improve download efficiency, reduce that buffering waits for when
Between, promote user experience.
Preferably, document data download apparatus 100 can also include:Judging unit 106, for receiving the jump
After browse request, judges whether the specified data block has been downloaded and finish, when judging result is not download, the download unit
104 preferentially download the specified data block, when judging result is to have downloaded, directly provide the specified data block.
In the above-mentioned technical solutions, it is preferred that if above-mentioned document data is the compound document for having paging feature,
Download unit 104 is additionally operable to when receiving browse request, downloads the file header of document data, the document described according to file header
The page number of data, creates page status list, and page status list is used to record the download state of each page number;Data block to be downloaded is true
Order member 102 determines the size of document data according to file header.
When establishing page status list and list to be downloaded, can be determined in page status list according to the file header of document data
Including number of pages and list to be downloaded applied in include data block quantity.It, can be excellent when user carries out formfeed browsing
It first downloads the corresponding data block of the specific page, such as the corresponding data block of the specific page is arranged in above-mentioned list to be downloaded
Front end.
If document data does not have paging feature, the specified number is directly judged according to the download state of the data block of record
Whether downloaded according to block, has determined the need for downloading according to judging result.If this article file data has paging feature, can build
Vertical page status list, is based on page status list, can determine whether that user asks whether the specific page of browsing has been downloaded, if formfeed browses
The page downloaded, then be not necessarily to re-download, save data traffic, directly display the data downloaded, improve browse efficiency.
The download unit 104 is additionally operable to after having downloaded the specified data block, continues to download and the specified data
The adjacent data block of block.If this article file data does not have paging feature, the adjacent data block of the specified data block is preferentially downloaded,
The content that may be browsed for predicting user.If this article file data has paging feature, in list to be downloaded, by specific page
The corresponding data block of lower one page of page up and/or specific page adjust to the lower section of the corresponding data block of specific page.Therefore, it is
Raising reading efficiency, can preferentially download the data block of the page adjacent with specific page, can be before and after fast browsing thereby using family
The content of page achievees the effect that prediction is downloaded.
In any of the above-described technical solution, it is preferred that this article file data download apparatus 100 can also include:Establish unit
108, the document size of the document data for being described according to file header creates empty file;Writing unit 110, according to number to be downloaded
It, will be in the content write-in empty file for the data block to be downloaded that downloaded according to location information of the block in document data.
A kind of terminal provided by the invention may include being carried under the document data described in any of the above-described technical solution
Set 100.The terminal can be that mobile phone, laptop, desktop computer, personal digital assistant, portable multimedia broadcasting are put
Device, tablet computer and/or E-book reader.
The terminal is by predictable streaming method for down loading, it can be achieved that the technique effect read when downloading, can also realize
The on-demand download of document data improves the browse efficiency of terminal user and the network utilization of terminal.User can stop at any time
Unwanted page is downloaded, to reach the technique effect for reducing network flow, improves user experience.
Fig. 2 shows the flow charts of document data method for down loading according to an embodiment of the invention.
As shown in Fig. 2, document data method for down loading according to an embodiment of the invention, includes the following steps:
Step 202, document data request is received, according to the download base unit size of data block, determines and downloads the text
The quantity of data block to be downloaded needed for file data;Step 204, according to pre-defined rule, determine that the download of data block to be downloaded is suitable
Sequence and download state;Step 206, according to the downloading order and download state, each data block to be downloaded is downloaded;Step 208, right
In each data block, the data block completed will be downloaded and be supplied to terminal.
The download base unit size of the data block can according to user need be configured, when each browsing content of user compared with
When more, it can will download base unit and be dimensioned to higher value, similarly, when each browsing content of user is less, can will download
Base unit is dimensioned to smaller value.This article file data can be structured document, such as word, CEBX, txt or PDF lattice
The document of formula.In the present embodiment, required data block is downloaded according to predetermined downloading order, it can readding according to user
Reading rate or other data blocks for requiring download required, that is, realize the function of being read when downloading, only need to browse by user
Data block be supplied to user, therefore, not only increase browse efficiency, decrease data traffic.
The preset rules may include the sequence of positions in the document data based on the data block to be downloaded, build
List to be downloaded is stood, the list to be downloaded is used to record the downloading order and download state of data block to be downloaded.The default rule
Can also include then the sequence that data block to be downloaded is set acording to the requirement of user, it is assumed that a document data includes picture and text
Word then can first download word, then download pictures, or can also first download pictures, then download word.The preset rules
It can also include the quantity for the data block downloaded every time according to the setting of the size of the quantity of data block, can first download two simultaneously
Then data block downloads three data blocks, is so incremented by, can alleviate initial download pressure so simultaneously, and equally can be with
Improve download efficiency.
In the above-mentioned technical solutions, it is preferred that when receiving jump browse request, preferential download browses with the jump
Ask corresponding specified data block.In some scenarios, user is not browsing document content in order, has only selected certain
A part is read, therefore, it is possible to provide the function for browsing of jumping, directly jump download user's specified data block, do not download
Data block before specified data block does not just have to download the data block that do not download, is if user exits reader
While user saves data traffic, download efficiency is also improved, reduces the time that buffering waits for, promotes user experience.
In the above-mentioned technical solutions, it is preferred that can also include the following steps before starting to download document data:If
Above-mentioned document data is the compound document for having paging feature, then when receiving browse request, downloads the text of document data
Part head creates page status list, page status list is for recording each page number according to the page number of the document data of file header description
Download state, and determine according to file header the size of document data.It, can when establishing page status list and list to be downloaded
The number for including applied in the number of pages for including in page status list and list to be downloaded is determined according to the file header of document data
According to the quantity of block.
In the above-mentioned technical solutions, it is preferred that after receiving cross-page request, can also include:Based on page status list
Judge whether specific page has been downloaded to finish;When judging result is not download, specified data block is preferentially downloaded, is in judging result
When having downloaded, the content of specific page is directly provided.
If document data does not have paging feature, the specified number is directly judged according to the download state of the data block of record
Whether downloaded according to block, has determined the need for downloading according to judging result.If this article file data has paging feature, can build
Vertical page status list, is based on page status list, can determine whether that user asks whether the specific page of browsing has been downloaded, if formfeed browses
The page downloaded, then be not necessarily to re-download, save data traffic, directly display the data downloaded, improve browse efficiency.
The document data download method further includes continuing to download and the specified number after having downloaded the specified data block
According to the adjacent data block of block.If this article file data does not have paging feature, the adjacent data block of the specified data block is downloaded, is used
In the content that prediction user may browse.If this article file data has paging feature, in list to be downloaded, by specific page
The corresponding data block of lower one page of page up and/or specific page is adjusted to the lower section of the corresponding data block of specific page.Therefore, in order to
Reading efficiency is improved, the data block of the page adjacent with specific page can be preferentially downloaded, it can page before and after fast browsing thereby using family
Content, achieve the effect that prediction download.
In any of the above-described technical solution, it is preferred that can also include:According to the document of the document data of file header description
Size creates empty file;According to location information of the data block to be downloaded in the document data, the number to be downloaded that will have been downloaded
It is written in the empty file according to the content of block.
It, can for required data block, such as the data block of current browse page needs in order to further increase speed of download
In the way of multi-process, while downloading two data blocks or downloading more data blocks simultaneously.
In the present embodiment, by taking the compound document with paging feature as an example.Fig. 3 shows another reality according to the present invention
The flow chart of the streaming method for down loading based on the document data with paging feature of example is applied, as shown in figure 3, including following step
Suddenly:
Step 302, the file header of the compound document with paging feature is downloaded.The file header of compound document describes document
The information such as essential information, including the page number of document, document size, font resource.Compound document includes multipage, and every page is only
Vertical browsing unit.
Step 304, empty file is created on disk according to compound document size.
Step 306, according to document page number, page status list is created, each page whether download information is preserved.
Step 308, start page status and examine thread, examine whether each page has been downloaded.If certain page has been downloaded, laminated is marked
The state of correspondence page in state list.Page status has:It has been downloaded that, do not downloaded, downloaded.
Finally, start document data download thread and carry out document content download.
For example, setting document size as X kilobytes, file header size is m kilobytes, and data block downloads base unit size
For y kilobytes, then the data block downloaded is needed to be(X-m/y)+ 1.One page can by one or more data chunks at.It waits for down
It carries data block according to position sequencing to be present in list to be downloaded, data block status has:It downloaded, downloaded.
Download thread traverses list to be downloaded, and list dynamically changeable to be downloaded can be continuous with the page turn over operation of user
The length and state for updating list to be downloaded update corresponding data block in list to be downloaded after a data block is downloaded
Download state, and data block contents are filled according to location information in the empty file of establishment.
This download thread works always until all data blocks have all been downloaded and finished in list to be downloaded.Thread is in following feelings
It is stopped under condition:
A, extraneous actively to stop this thread work;
B, the state of all block number evidences is all to have downloaded in data block list.
The N pages of browsing is redirected when the user clicks, first checks whether the N pages downloaded from page status list, if
It downloads, the reader that then be used directly opens this page, and is shown to user and sees;If N page status is not download, by this page
The front end of list to be downloaded is added in data block, into row major downloading data, it can be ensured that user can most see that oneself is desired clear soon
The page look at, the length of list to be downloaded in this way is with regard to elongated, after the N pages of data block is downloaded, in list to be downloaded
This page of corresponding download state is changed to download.It in order to improve reading efficiency, predicts according to user's use habit, preferentially will
The front end of list to be downloaded is added in the N-1 pages and N+1 pages of data block, can preferentially download front and back page data, thereby using
Family can achieve the effect that prediction is downloaded with page content before and after fast browsing.
It is described in detail according to the technique and scheme of the present invention with reference to Fig. 4.
1. downloading the file header of the compound document with paging feature.
The file header of compound document describes the essential information of document, including the page number of document, document size, font resource
Etc. information.Compound document includes multipage, and every page is independent browsing unit.
2. creating empty file on disk according to compound document size, it is assumed that document size is 100 kilobytes.
3. according to document page number(Assuming that document page number has page 30), page status list is created, the page status list
Whether length is 30, preserve each page download information.
4. starting page status examines thread, examine whether each page has been downloaded.
When certain page has been downloaded, then the state of the correspondence page in flag page status list.Page status has:Downloaded, do not downloaded,
It is downloading.
5. starting document data download thread carries out document content download.
It is 100 kilobytes in document size, file header size is 2 kilobytes, and the page number is page 30, and data block is downloaded substantially single
When position size is 3 kilobytes, the data block downloaded is needed to be(100-2)Divided by 3 rounding add 1 be 33 pieces.One page can be by 1
A or multiple data chunks at.Data block to be downloaded is present according to position sequencing in list to be downloaded, under original state
List length to be downloaded is 33, there is data block status in list to be downloaded:It downloaded, downloaded.
Download thread traverses list to be downloaded, which can be continuous with the page turn over operation of user
Ground updates the length and state of list to be downloaded, after a data block is downloaded, updates corresponding data in list to be downloaded
The download state of block, and data block contents are filled according to location information in the empty file of establishment.
Fig. 4 shows cross-page browsing streaming download process flow chart according to an embodiment of the invention, as shown in figure 4, packet
Include following steps:
Step 402, user, which clicks, redirects browsing page 10.
Step 404, start page status and examine thread.Step 406, from page status list check page 10 whether under
It carries, if downloaded, enters step 408, directly open this page using reader, and be shown to user and see;If the 10th
Page status is not download, then enters step 410, the data block of this page is added to the front end of list to be downloaded.It is preferential to download the 10th
The data block of page, it can be ensured that user can most see that oneself wants the page of browsing soon.In order to improve reading efficiency, make according to user
It is predicted with custom, the data block of page 9 and page 11 is preferentially added to the front end of list to be downloaded, can preferentially download front and back number of pages
According to, thereby using family can with page content before and after fast browsing, achieve the effect that prediction download.
As shown in figure 5, the continuous execution of the browsing page turn over operation with user, list to be downloaded also dynamic change therewith,
Structure in original state, list to be downloaded is as shown in the left list in Fig. 5.When the cross-page browsing of user page 10, by the
The corresponding data blocks of page 10 are added to the front end of list to be downloaded, preferentially download the corresponding data block of page 10, wait for down at this time
The length and state listed is also changed, as shown in the right list in Fig. 5.
Document with structured features may not be to be divided according to page, but divided according to structures such as chapters and sections,
Or the classification according to information(Such as picture, word)It is divided, with reference to Fig. 6 with the text with chapters and sections structure feature
Shelves come illustrate jump browsing document download process method.As shown in fig. 6, including the following steps:In step 602, it is assumed that user
The document with chapters and sections structure feature is being read, and is currently reading the 2nd chapter, user thinks direct reading to the 8th chapter at this time
Content, then request redirect browsing the document the 8th chapter.
In step 604, start chapters and sections thermodynamic state verification thread.In step 606, judge whether the content of the 8th chapter has been downloaded, if
It has been downloaded that, then enter step 608, the content of the 8th chapter is directly supplied to terminal;If not downloading, 610 are entered step, by the 8th
The corresponding data block of chapter(One data block or multiple data blocks)It is added to the front end of list to be downloaded, the 8th chapter of preferential download
Content ignores the 3rd chapter to the content between the 7th chapter.Therefore, download efficiency can be improved and save network flow.In order to reach
The effect downloaded to prediction can download the content of the 7th chapter and the 9th chapter into row major after the content for having downloaded the 8th chapter.
Above in association with attached drawing be described in detail according to the technique and scheme of the present invention, it can be achieved that while document data while download side
Browsing, can also realize the quick cross-page browsing of document data, and by predictable method for down loading, improve the clear of terminal user
Look at the network utilization of efficiency and terminal.User can stop downloading unwanted page at any time, to reach reduction network flow
Technique effect.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field
For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, any made by repair
Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.