CN107220221A - The read method and device of EPub files based on Android platform - Google Patents
The read method and device of EPub files based on Android platform Download PDFInfo
- Publication number
- CN107220221A CN107220221A CN201610166664.4A CN201610166664A CN107220221A CN 107220221 A CN107220221 A CN 107220221A CN 201610166664 A CN201610166664 A CN 201610166664A CN 107220221 A CN107220221 A CN 107220221A
- Authority
- CN
- China
- Prior art keywords
- files
- epub
- file
- epub files
- spine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/14—Tree-structured documents
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the present invention provides a kind of read method and device of the EPub files based on Android platform, wherein, this method includes:EPub files are obtained, and parsing generation object information is carried out to the content file in the EPub files;Resource file to be loaded is obtained according to the object information, and js scripts and/or css patterns are added in the resource file, html files are generated;The html files are shown.The read method and device of EPub files provided in an embodiment of the present invention based on Android platform, it is possible to increase the reading speed of EPub files, improve the experience of user.
Description
Technical field
The present embodiments relate to field of computer technology, more particularly to it is a kind of based on Android platform
The read method and device of EPub files.
Background technology
Electronic publishing (Electronic Publication, abbreviation EPub), is one free open
Standard, belongs to the content that one kind " can be rearranged " automatically;Namely word content can basis
The characteristic of arrangement for reading, is shown in the way of being best suitable for reading.EPub file internals are marked using XML
Standard shows word and carrys out wrapped file content with zip compressed formats.
At present, conventional EPub document analysis mode is solution pressure type.To EPub by way of solving pressure type
File is parsed, and the complete decompression content of whole file can be found in some position of file,
But this analysis mode requires higher to the read or write speed of cache location, if the read-write speed of cache location
Degree is slower, then the speed for opening EPub files will be very slow, has had a strong impact on the experience of user.
The content of the invention
The embodiment of the present invention provides a kind of read method and device of the EPub files based on Android platform, uses
To improve the reading speed of EPub files, the experience of user is improved.
First aspect of the embodiment of the present invention provides a kind of read method of the EPub files based on Android platform,
This method includes:
EPub files are obtained, and parsing generation object letter is carried out to the content file in the EPub files
Breath;
Resource file to be loaded is obtained according to the object information, and js scripts and/or css patterns are added
It is added in the resource file, generates html files;
The html files are shown.
Second aspect of the embodiment of the present invention provides a kind of reading device of the EPub files based on Android platform,
The device includes:
First acquisition module, for obtaining EPub files;
First processing module, for carrying out parsing generation object letter to the content file in the EPub files
Breath;
Second acquisition module, for obtaining resource file to be loaded according to the object information;
Second processing module, it is raw for js scripts and/or css patterns to be added in the resource file
Into html files;
Display module, for being shown to the html files.
The third aspect of the embodiment of the present invention provides a kind of reading device of the EPub files based on Android platform,
The device, including:
Processor;
For the memory for the execute instruction for storing the processor;
Wherein, the processor is configured as:
EPub files are obtained, and parsing generation object letter is carried out to the content file in the EPub files
Breath;
Resource file to be loaded is obtained according to the object information, and js scripts and/or css patterns are added
It is added in the resource file, generates html files;
The html files are shown.
The read method and device of EPub files provided in an embodiment of the present invention based on Android platform, pass through
The object information for parsing generation according to content file obtains resource file to be loaded, and by by js scripts
And/or css patterns are added in the resource file, the html files for being shown are generated, are realized
The quick readings of EPub files, improves the experience of user.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be right
The accompanying drawing used required in embodiment or description of the prior art is briefly described, it should be apparent that,
Drawings in the following description are only some embodiments of the present invention, for those of ordinary skill in the art
For, without having to pay creative labor, it can also obtain other according to these accompanying drawings
Accompanying drawing.
The read method for the EPub files based on Android platform that Fig. 1 provides for one embodiment of the invention
Schematic flow sheet;
The reading side for the EPub files based on Android platform that Fig. 2 provides for further embodiment of this invention
The schematic flow sheet of method;
The reading device for the EPub files based on Android platform that Fig. 3 provides for one embodiment of the invention
Structural representation;
The reading dress for the EPub files based on Android platform that Fig. 4 provides for further embodiment of this invention
The structural representation put;
The reading dress for the EPub files based on Android platform that Fig. 5 provides for further embodiment of this invention
The structural representation put.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out
Clearly and completely describe, it is clear that described embodiment is only a part of embodiment of the invention, and
The embodiment being not all of.Based on the embodiment in the present invention, those of ordinary skill in the art are not doing
Go out the every other embodiment obtained under the premise of creative work, belong to the scope of protection of the invention.
The term " comprising " and " having " of description and claims of this specification and their times
What is deformed, it is intended that covering is non-exclusive to be included, for example, containing the process or knot of series of steps
The device of structure is not necessarily limited to those structures clearly listed or step but may include not list clearly
Or for these processes or device intrinsic other steps or structure.
The stream of the read method for the EPub files based on Android platform that Fig. 1 provides for one embodiment of the invention
Journey schematic diagram, the read method for the EPub files that the present embodiment is provided can be by including Android platform
The reading devices of EPub files is performed, as shown in figure 1, the method that the present embodiment is provided includes:
Step S101, acquisition EPub files, and parsing generation is carried out to the content file in EPub files
Object information.
The solution pressure type acquisition modes of traditional EPub files are by the zip compressed files comprising EPub files
Decompressed, and the acquisition EPub files from the file after decompression.Compared to traditional EPub files
In acquisition modes, the present embodiment, using direct-type acquisition modes obtain EPub files, i.e., by using
The mode of input/output date flow (i.e. IO streams) is direct from the zip compressed files comprising EPub files
Obtain EPub files.
The direct-type acquisition modes used in the present embodiment, without being decompressed to zip compressed files
EPub file acquisitions are realized, the acquisition speed of EPub files is improved.
Further, in the present embodiment, it is preferred to use the Pull analysis modes that Android platform is recommended are to EPub
Content file in file is parsed, and obtains the spine contents and spine contents pair of content file
The resource path answered.Wherein, the spine contents of content file can include the chapters and sections of e-book or article
The content such as order and number of pages order, each chapters and sections, one resource path of each number of pages correspondence passes through phase
The resource path answered results in correspondence chapters and sections or the resource file of number of pages.In the present embodiment, content text
The spine contents of part are the reading core of EPub files.
Further, the spine contents of content file and the corresponding resource road of spine contents are being obtained
Behind footpath, the present embodiment encapsulates the spine contents of content file and the corresponding resource path of spine contents
To generate object information, to reach the purpose for conveniently understanding and using.
Rapid S102, obtain resource file to be loaded according to the object information, and by js scripts and/or
Css patterns are added in the resource file, generate html files.
Specifically, due to being packaged with spine contents and the corresponding resource path of spine contents in object information,
Therefore, in this step, it can be waited open according to the order of each chapters and sections in spine contents, each number of pages to find
Chapters and sections or the corresponding resource path of number of pages are opened, so that according to the corresponding resource road of chapters and sections or number of pages to be opened
Footpath loads corresponding resource file.Need exist for, the resource file that acquisition is loaded in this step is excellent
Elect the file of html forms as.
The beneficial effect of this step is, need to only be loaded when user opens e-book or article one it is right
The html file streams answered, thus greatly improve the efficiency of file loading, shorten file and show
The time shown, advantageously form preferable Consumer's Experience.
Further, in order to realize in some miscellaneous functions, the present embodiment, by the way that the money obtained will be loaded
Source file is converted into character string, and js scripts and/or css patterns are added into the head of the character string, with
Realize that page jump, paging, duplication such as paste at the miscellaneous function, and loading is gone according to the css patterns of addition
Display.After js scripts and/or css patterns are added into the head of character string, according to html files
Call format splices the head and the tail of character string, forms html files to be presented.
Herein it should be noted that customized js can not also be added in this step in resource file
Script and/or css patterns.If js scripts and/or css patterns need not be added, directly loading can be obtained
The resource file obtained is shown.
Rapid S103, the html files are shown.
Specifically, the displaying of html files can be by supporting the browser control part of html files to perform.
The read method and device for the EPub files based on Android platform that the present embodiment is provided, pass through basis
The object information of content file parsing generation obtains resource file to be loaded, and by by js scripts and/
Or css patterns are added in the resource file, the html files for being shown are generated, are realized
The quick reading of EPub files, improves the experience of user.
The read method for the EPub files based on Android platform that Fig. 2 provides for further embodiment of this invention
Schematic flow sheet, as shown in Fig. 2 on the basis of embodiment illustrated in fig. 1, the side that the present embodiment is provided
Method includes:
Step S201, acquisition EPub files.
Step S202, the integrality to the EPub files are detected, if the EPub files are complete,
Step S203 is then performed, step 206 is otherwise performed.
Specifically, the integrality to EPub files is detected, be to being included in EPub files in
Whether appearance is completely detected (such as whether the file format in EPub files marks and understand).Specifically
Detection perform method similarly to the prior art, repeat no more herein.
Step S203, in the EPub files content file carry out parsing generation object information, and
Catalogue file in the EPub files is parsed, the catalogue of the EPub files is obtained.
, will also be to EPub while parsing generation object information is carried out to content file in the present embodiment
Catalogue file in file is parsed, so as to obtain the mesh of EPub files by the parsing to file destination
Record, is shown with facilitating to the catalogue of books or article.
Step S204, obtain resource file to be loaded according to the object information, and by js scripts and/
Or css patterns are added in the resource file, html files are generated.
Step S205, the html files are shown.
Step S206, end parsing operation.
The read method and device for the EPub files based on Android platform that the present embodiment is provided, pass through basis
The object information of content file parsing generation obtains resource file to be loaded, and by by js scripts and/
Or css patterns are added in the resource file, the html files for being shown are generated, are realized
The quick reading of EPub files, improves the experience of user.
The knot of the reading device for the EPub files based on Android platform that Fig. 3 provides for one embodiment of the invention
Structure schematic diagram, the reading device can be the mobile phone terminal for carrying Android system, tablet personal computer etc..Such as
Shown in Fig. 3, the reading device that the present embodiment is provided includes:
First acquisition module 10, for obtaining EPub files;
First processing module 20, for carrying out parsing generation pair to the content file in the EPub files
Image information;
Second acquisition module 30, for obtaining resource file to be loaded according to the object information;
Second processing module 40, for js scripts and/or css patterns to be added in the resource file,
Generate html files;
Display module 50, for being shown to the html files.
Wherein, the first acquisition module 10, specifically for using IO stream by the way of from zip compressed files
Obtain the EPub files.
First processing module 20, including:
First processing submodule 21, for being parsed to the content file in the EPub files, is obtained
Take the spine contents and the corresponding resource path of the spine contents of the content file;
Submodule 22 is encapsulated, for being packaged generation institute to the spine contents and the resource path
State object information.
Second acquisition module 30, specifically for according to the spine contents, and the spine contents pair
The resource path answered obtains resource file to be loaded.
Second processing module 40, including:
Transform subblock 41, for being changed to the resource file, generates corresponding character string;
Second processing submodule 42, for the js scripts and/or css patterns to be added into the character string
Head, and according to html forms generate html files.
Further, the first processing module 20, is additionally operable to:
Catalogue file in the EPub files is parsed, the catalogue of the EPub files is obtained.
The reading device that the present embodiment is provided can be used in performing method as shown in Figure 1, and it is specifically held
Line mode and beneficial effect are similar with the embodiment shown in Fig. 1, repeat no more herein.
The reading device for the EPub files based on Android platform that Fig. 4 provides for further embodiment of this invention
Structural representation, the reading device can be used in performing method as shown in Figure 2.As shown in figure 4, should
Device also includes on the basis of embodiment illustrated in fig. 3:Detection module 50, detection module 50 be used for pair
The integrality of the EPub files is detected.
The executive mode and beneficial effect for the reading device that the present embodiment is provided and holding for embodiment illustrated in fig. 2
Line mode is similar with beneficial effect, repeats no more herein.
The reading device for the EPub files based on Android platform that Fig. 5 provides for further embodiment of this invention
Structural representation, as shown in figure 5, the reading device includes:
Processor and for the memory for the execute instruction for storing the processor;
Wherein, the processor is configured as:
EPub files are obtained, and parsing generation object letter is carried out to the content file in the EPub files
Breath;
Resource file to be loaded is obtained according to the object information, and js scripts and/or css patterns are added
It is added in the resource file, generates html files;
The html files are shown.
The executive mode and beneficial effect for the reading device that the present embodiment is provided and holding for embodiment illustrated in fig. 1
Line mode is similar with beneficial effect, repeats no more herein.
Finally it should be noted that:Various embodiments above is merely illustrative of the technical solution of the present invention, rather than right
It is limited;Although the present invention is described in detail with reference to foregoing embodiments, this area it is common
Technical staff should be understood:It can still modify to the technical scheme described in foregoing embodiments,
Or equivalent substitution is carried out to which part or all technical characteristic;And these modifications or replacement, and
The essence of appropriate technical solution is not set to depart from the scope of various embodiments of the present invention technical scheme.
Claims (13)
1. a kind of read method of the EPub files based on Android platform, it is characterised in that including:
EPub files are obtained, and parsing generation object letter is carried out to the content file in the EPub files
Breath;
Resource file to be loaded is obtained according to the object information, and js scripts and/or css patterns are added
It is added in the resource file, generates html files;
The html files are shown.
2. according to the method described in claim 1, it is characterised in that obtain EPub files, and to institute
State the content file in EPub files and carry out parsing generation object information, including:
Using the EPub files are obtained by the way of IO flows from zip compressed files;
Content file in the EPub files is parsed, in the spine for obtaining the content file
Hold resource path corresponding with the spine contents;
The generation object information is packaged to the spine contents and the resource path.
3. method according to claim 2, it is characterised in that described to be obtained according to the object information
Resource file to be loaded is taken, and js scripts and/or css patterns are added in the resource file, it is raw
Into html files, including:
Obtain to be loaded according to the spine contents, and the corresponding resource path of the spine contents
Resource file;
The resource file is changed, corresponding character string is generated;
The js scripts and/or css patterns are added to the head of the character string, and according to html lattice
Formula generates html files.
4. according to the method described in claim 1, it is characterised in that after the acquisition EPub files,
Also include:
Catalogue file in the EPub files is parsed, the catalogue of the EPub files is obtained.
5. according to the method described in claim 1, it is characterised in that after the acquisition EPub files,
Also include:
Integrality to the EPub files is detected, if the EPub files are complete, to described
Content file in EPub files is parsed.
6. a kind of reading device of the EPub files based on Android platform, it is characterised in that described device
Including:
First acquisition module, for obtaining EPub files;
First processing module, for carrying out parsing generation object letter to the content file in the EPub files
Breath;
Second acquisition module, for obtaining resource file to be loaded according to the object information;
Second processing module, it is raw for js scripts and/or css patterns to be added in the resource file
Into html files;
Display module, for being shown to the html files.
7. reading device according to claim 6, it is characterised in that first acquisition module,
Specifically for obtaining the EPub files from zip compressed files by the way of IO streams.
8. reading device according to claim 7, it is characterised in that the first processing module,
Including:
First processing submodule, for being parsed to the content file in the EPub files, obtains institute
State the spine contents and the corresponding resource path of the spine contents of content file;
Submodule is encapsulated, it is described right for being packaged generation to the spine contents and the resource path
Image information.
9. reading device according to claim 8, it is characterised in that second acquisition module,
Specifically for obtaining to be added according to the spine contents, and the corresponding resource path of the spine contents
The resource file of load.
10. reading device according to claim 9, it is characterised in that the Second processing module,
Including:
Transform subblock, for being changed to the resource file, generates corresponding character string;
Second processing submodule, for the js scripts and/or css patterns to be added into the character string
Head, and generate html files according to html forms.
11. reading device according to claim 6, it is characterised in that the first processing module,
It is additionally operable to:
Catalogue file in the EPub files is parsed, the catalogue of the EPub files is obtained.
12. reading device according to claim 6, it is characterised in that described device, in addition to:
Detection module, is detected for the integrality to the EPub files.
13. a kind of reading device of the EPub files based on Android platform, it is characterised in that including:
Processor;
For the memory for the execute instruction for storing the processor;
Wherein, the processor is configured as:
EPub files are obtained, and parsing generation object letter is carried out to the content file in the EPub files
Breath;
Resource file to be loaded is obtained according to the object information, and js scripts and/or css patterns are added
It is added in the resource file, generates html files;
The html files are shown.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610166664.4A CN107220221A (en) | 2016-03-22 | 2016-03-22 | The read method and device of EPub files based on Android platform |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610166664.4A CN107220221A (en) | 2016-03-22 | 2016-03-22 | The read method and device of EPub files based on Android platform |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107220221A true CN107220221A (en) | 2017-09-29 |
Family
ID=59927374
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610166664.4A Pending CN107220221A (en) | 2016-03-22 | 2016-03-22 | The read method and device of EPub files based on Android platform |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107220221A (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103677803A (en) * | 2012-09-19 | 2014-03-26 | 三星电子株式会社 | System and method for creating e-book including user effects |
CN103761277A (en) * | 2014-01-09 | 2014-04-30 | 北京掌阔技术有限公司 | ePub electronic book loading method and system |
-
2016
- 2016-03-22 CN CN201610166664.4A patent/CN107220221A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103677803A (en) * | 2012-09-19 | 2014-03-26 | 三星电子株式会社 | System and method for creating e-book including user effects |
CN103761277A (en) * | 2014-01-09 | 2014-04-30 | 北京掌阔技术有限公司 | ePub electronic book loading method and system |
Non-Patent Citations (1)
Title |
---|
伊恩·达尔文: "《Java经典实例 第2版》", 28 February 2009, 中国电力出版社 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8769430B2 (en) | Multi-column formatted page scrolling | |
CN107577509A (en) | A kind of method, terminal and computer-readable recording medium for loading application interface | |
CN106250156B (en) | Constructing method of component and device, component call method and apparatus | |
CN106980508A (en) | Method and apparatus for generating the page | |
CN104020984B (en) | A kind of method and device for generating static page | |
CN104850388B (en) | web page rendering method and device | |
CN108664248A (en) | A kind of generation method and device of wechat small routine | |
US20150178263A1 (en) | System and Method for Constructing Markup Language Templates and Input Data Structure Specifications | |
CN104915186B (en) | A kind of method and apparatus making the page | |
US20150178258A1 (en) | System and Method for Processing Markup Language Templates from Partial Input Data | |
CN109814866A (en) | Page application is converted into the treating method and apparatus of native applications | |
CN109410932A (en) | Voice operating method and apparatus based on HTML5 webpage | |
CN106326194A (en) | Directory generation method and apparatus applied to file format conversion scene | |
CN106776800B (en) | Page generation method, device and system for AngularJS framework | |
MXPA06000813A (en) | System and method for storing a document in a serial binary format. | |
CN105956133B (en) | Method and device for displaying file on intelligent terminal | |
CN104572744B (en) | structured document generation method and device | |
CN108228181A (en) | The method and device of embedded html page in html page | |
CN109101520A (en) | A kind of display methods of electronic documentation and electronic documentation | |
CN107688456A (en) | Document generating method, equipment and computer-readable recording medium | |
CN111562911A (en) | Webpage editing method and device and storage medium | |
CN104156421A (en) | Method, device and system for displaying page | |
CN107423271A (en) | Document structure tree method and apparatus | |
CN102637128B (en) | A kind of general level selects the generation method of control | |
CN107220221A (en) | The read method and device of EPub files based on Android platform |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170929 |
|
RJ01 | Rejection of invention patent application after publication |