Remove or move java.awt dependencies
[nikiroo-utils.git] / src / be / nikiroo / fanfix / supported / MangaFox.java
index d6f146429bf19a4c67d4b7305c89a9c96f8d7229..8d31cb83adacf1a7fa7f80dda01a3ac380197086 100644 (file)
@@ -1,6 +1,5 @@
 package be.nikiroo.fanfix.supported;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -13,7 +12,7 @@ import java.util.Scanner;
 
 import be.nikiroo.fanfix.Instance;
 import be.nikiroo.fanfix.data.MetaData;
-import be.nikiroo.utils.ImageUtils;
+import be.nikiroo.utils.Image;
 import be.nikiroo.utils.Progress;
 import be.nikiroo.utils.StringUtils;
 
@@ -103,7 +102,7 @@ class MangaFox extends BasicSupport {
                try {
                        in.reset();
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
 
                line = getLine(in, "/artist/", 0, false);
@@ -163,7 +162,7 @@ class MangaFox extends BasicSupport {
                return null;
        }
 
-       private BufferedImage getCover(InputStream in) {
+       private Image getCover(InputStream in) {
                String line = getLine(in, " property=\"og:image\"", 0);
                String cover = null;
                if (line != null) {
@@ -186,7 +185,7 @@ class MangaFox extends BasicSupport {
                        try {
                                coverIn = openEx(cover);
                                try {
-                                       return ImageUtils.fromStream(coverIn);
+                                       return new Image(coverIn);
                                } finally {
                                        coverIn.close();
                                }
@@ -262,7 +261,7 @@ class MangaFox extends BasicSupport {
                                                }
                                        });
                                } catch (MalformedURLException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
                }
@@ -309,7 +308,7 @@ class MangaFox extends BasicSupport {
                        try {
                                in.reset();
                        } catch (IOException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
 
                        String linkImageLine = getLine(in, "return enlarge()", 1);
@@ -348,7 +347,7 @@ class MangaFox extends BasicSupport {
                                try {
                                        in.close();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
 
@@ -361,9 +360,10 @@ class MangaFox extends BasicSupport {
                                        setCurrentReferer(url);
                                        pg.setProgress((i++) % pg.getMax());
                                } catch (IOException e) {
-                                       Instance.syserr(new IOException(
-                                                       "Cannot get the next manga page which is: "
-                                                                       + linkNext, e));
+                                       Instance.getTraceHandler().error(
+                                                       new IOException(
+                                                                       "Cannot get the next manga page which is: "
+                                                                                       + linkNext, e));
                                }
                        }