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參考。 –
請問我是否無法澄清我的問題。 –