如何使用EPUBLIB阅读EPUB书?

Tar*_*uni 5 android epub epublib

我找到了一个使用epublib在android中阅读epub书籍的解决方案.我能够阅读这本书的字幕.但我没有找到一种方法来逐行阅读内容.我该如何实现这一目标?

获取图书标题的示例代码是

  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);
    }
}
Run Code Online (Sandbox Code Playgroud)

http://www.siegmann.nl/epublib/android获得此代码

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

小智 7

我不确定这是在epub文件中导航的方法.据我所知(直到现在 - 我还在学习),更好的方法来获得所有书籍cocntent是基于脊柱部分.但仍然 - 我不知道如何将这两件事(TOC和真正的脊椎)与epublib接口连接起来.根据文档: "脊柱部分是本书的部分,按照阅读本书的顺序.这与目录部分形成对比,而这部分是本书部分的索引."

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

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) {
Run Code Online (Sandbox Code Playgroud)