Improve importing progress reporting
[fanfix.git] / src / be / nikiroo / fanfix / supported / Epub.java
index f6a0b410338a3a1a7635601be402054fe5c761d1..47da1ac2259abbb313788583ba4420ba1dae8134 100644 (file)
@@ -12,12 +12,11 @@ import java.util.Map.Entry;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import javax.imageio.ImageIO;
-
 import be.nikiroo.fanfix.Instance;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.utils.IOUtils;
 import be.nikiroo.utils.MarkableFileInputStream;
+import be.nikiroo.utils.Progress;
 
 /**
  * Support class for EPUB files created with this program (as we need some
@@ -62,22 +61,22 @@ class Epub extends InfoText {
        }
 
        @Override
-       protected List<Entry<String, URL>> getChapters(URL source, InputStream in)
-                       throws IOException {
+       protected List<Entry<String, URL>> getChapters(URL source, InputStream in,
+                       Progress pg) throws IOException {
                if (fakeIn != null) {
                        fakeIn.reset();
-                       return super.getChapters(fakeSource, fakeIn);
+                       return super.getChapters(fakeSource, fakeIn, pg);
                }
 
                return null;
        }
 
        @Override
-       protected String getChapterContent(URL source, InputStream in, int number)
-                       throws IOException {
+       protected String getChapterContent(URL source, InputStream in, int number,
+                       Progress pg) throws IOException {
                if (fakeIn != null) {
                        fakeIn.reset();
-                       return super.getChapterContent(fakeSource, fakeIn, number);
+                       return super.getChapterContent(fakeSource, fakeIn, number, pg);
                }
 
                return null;
@@ -115,7 +114,7 @@ class Epub extends InfoText {
                                        // Cover
                                        if (getCover()) {
                                                try {
-                                                       cover = ImageIO.read(zipIn);
+                                                       cover = IOUtils.toImage(zipIn);
                                                } catch (Exception e) {
                                                        Instance.syserr(e);
                                                }