如何使用EPUBLIB阅读EPUB书籍?如何使用、书籍、EPUBLIB、EPUB

2023-09-06 00:32:06 作者:百象圖

我找到了解决阅读的epub电子书使用epublib机器人。我能读这本书的副标题。但我没有找到一种方法,通过内容的行读取行。我怎样才能达致这?

I found a solution for reading epub books in android using epublib. I am able to read the subtitles of the book. But I didn't find a way to read the line by line of the content. How can I acheive this?

样品code为获得这本书的标题是

Sample code for getting titles of the book is

  private void logTableOfContents(List<TOCReference> tocReferences, int depth) {
    if (tocReferences == null) {
        return;
    }
    for (TOCReference tocReference : tocReferences) {
        StringBuilder tocString = new StringBuilder();
        StringBuilder tocHref=new StringBuilder();
        for (int i = 0; i < depth; i++) {
            tocString.append("\t");
            tocHref.append("\t");
        }
        tocString.append(tocReference.getTitle());

        tocHref.append(tocReference.getCompleteHref());
        Log.e("Sub Titles", tocString.toString());
        Log.e("Complete href",tocHref.toString());

        //logTableOfContents(tocReference.getChildren(), depth + 1);
    }
}

从 http://www.siegmann.nl/epublib/android

我怎样才能得到这本书的故事...

How can I get the story of the book...

推荐答案

我不知道的是,在EPUB文件浏览方式。据我所知,(到现在 - 我还在学习),更好的方式来获取所有的书cocntent基于脊部。 但还是 - 我不知道如何与epublib接口连接此两件事情(TOC和实际脊椎)。 根据文档: 脊椎部分是本书的顺序书应该读的部分,这与目录部分的表,该表中的索引书的章节。的

I'm not sure is that is the way to navigate in epub file. As far as I know (till now - I'm still learning), better way to get all book cocntent is based on spine section. But still - I don't know how to connect this two things (TOC and real spine) with epublib interface. According to documentation: "The spine sections are the sections of the book in the order in which the book should be read. This contrasts with the Table of Contents sections which is an index into the Book's sections."

这是什么 - 如果你likie - 这是一个片段:

that is something - if You likie - this is a snippet:

Spine spine = new Spine(book.getTableOfContents());
for (SpineReference bookSection : spine.getSpineReferences()) {
            Resource res = bookSection.getResource();
                try {
                    InputStream is = res.getInputStream();
                    //do something with stream
                } catch (IOException e) {