1
我在HTTP服务器上有一个epub文件,当我尝试读取Ex:Author Name,Book Title等时,它读取了整个epub文件。我想阅读整个文件的阅读页面。 NB:here Android epublib参考。同时阅读Android上的epub文件
@Override
protected String doInBackground(String... params) {
try {
url = new URL(bookPath);
// create the new connection
urlConnection = (HttpURLConnection) url.openConnection();
// set up some things on the connection
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
// and connect!
urlConnection.connect();
// this will be used in reading the data from the internet
inputStream = urlConnection.getInputStream();
// Load Book from inputStream
book = (new EpubReader()).readEpub(inputStream);
maxLocation = book.getTableOfContents().size();
// get the book's title
String bookName = book.getTitle();
String authorName = book.getMetadata().getAuthors().toString();
Log.i("Books", "Title: " + bookName + " Author: " + authorName);
title = "Title: " + bookName + " Author: " + authorName;
int i = 1;
for (TOCReference index : book.getTableOfContents()
.getTocReferences()) {
stringBuffer.append(index.getTitle() + "</br>");
i++;
}
} catch (Exception e) {
e.printStackTrace();
}
return "Executed";
}
什么是你的代码中的'EpubReader'?它来自哪个图书馆? 顺便说一句,EPUB文件是几个文件的(ZIP)容器。在检查元数据之前,您需要先下载它。 此外,在EPUB中没有“页面”的概念。 请澄清你的问题。 –
[这里](http://www.siegmann.nl/epublib/android)Android epublib参考。 –
请问我是否无法澄清我的问题。 –