优化epublib,清除警告,尝试兼容epub v3格式的导出。

pull/915/head
ag2s20150909 4 years ago
parent dc24ae7244
commit 5b58ea45eb
  1. 2
      app/src/main/java/io/legado/app/model/localBook/EpubFile.kt
  2. 1
      epublib/src/main/java/me/ag2s/epublib/domain/EpubBook.java
  3. 7
      epublib/src/main/java/me/ag2s/epublib/epub/EpubReader.java

@ -120,7 +120,7 @@ class EpubFile(var book: Book) {
}
resources.add(resource)
} while (zipEntry != null)
if (resources.size() > 0) return EpubReader().readEpub(resources)
if (resources.size() > 0) return EpubReader().readEpubBook(resources)
} catch (e: Exception) {
e.printStackTrace()
}

@ -5,4 +5,5 @@ package me.ag2s.epublib.domain;
*/
@SuppressWarnings("unused declaration")
public class EpubBook extends Book {
}

@ -14,6 +14,7 @@ import java.util.zip.ZipInputStream;
import me.ag2s.epublib.Constants;
import me.ag2s.epublib.domain.Book;
import me.ag2s.epublib.domain.EpubBook;
import me.ag2s.epublib.domain.MediaType;
import me.ag2s.epublib.domain.MediaTypes;
import me.ag2s.epublib.domain.Resource;
@ -30,7 +31,7 @@ public class EpubReader {
private static final String TAG = EpubReader.class.getName();
private final BookProcessor bookProcessor = BookProcessor.IDENTITY_BOOKPROCESSOR;
@SuppressWarnings("unused")
public Book readEpub(InputStream in) throws IOException {
return readEpub(in, Constants.CHARACTER_ENCODING);
}
@ -97,9 +98,13 @@ public class EpubReader {
return readEpub(resources);
}
@SuppressWarnings("unused")
public Book readEpub(Resources resources) {
return readEpub(resources, new Book());
}
public EpubBook readEpubBook(Resources resources) {
return (EpubBook) readEpub(resources, new Book());
}
public Book readEpub(Resources resources, Book result) {
if (result == null) {

Loading…
Cancel
Save