import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.supported.BasicSupport;
import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.ImageUtils;
import be.nikiroo.utils.MarkableFileInputStream;
/**
if (!cached.exists() || isOld(cached, true)) {
InputStream imageIn = open(url, null, true);
- ImageIO.write(IOUtils.toImage(imageIn), Instance.getConfig()
+ ImageIO.write(ImageUtils.fromStream(imageIn), Instance.getConfig()
.getString(Config.IMAGE_FORMAT_CONTENT).toLowerCase(),
cached);
}
*
* @param url
* the resource to open
+ * @param allowTooOld
+ * allow files even if they are considered too old
+ * @param stable
+ * a stable file (that dones't change too often) -- parameter
+ * used to check if the file is too old to keep or not
*
* @return the opened resource if found, NULL i not
*
* @throws IOException
* in case of I/O error
*/
- private InputStream load(URL url, boolean allowOld, boolean stable)
+ private InputStream load(URL url, boolean allowTooOld, boolean stable)
throws IOException {
File cached = getCached(url);
- if (cached.exists() && !isOld(cached, stable)) {
+ if (cached.exists() && (allowTooOld || !isOld(cached, stable))) {
return new MarkableFileInputStream(new FileInputStream(cached));
}