git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add more warnings source to 1.6) and fix warnings
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
Cache.java
diff --git
a/src/be/nikiroo/fanfix/Cache.java
b/src/be/nikiroo/fanfix/Cache.java
index 632c8441a35d596dfa6a2f2fc4c635542d1dd83e..40ce15efec98860c559177dc0734c3b68377f797 100644
(file)
--- a/
src/be/nikiroo/fanfix/Cache.java
+++ b/
src/be/nikiroo/fanfix/Cache.java
@@
-26,6
+26,7
@@
import javax.imageio.ImageIO;
import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.supported.BasicSupport;
import be.nikiroo.utils.IOUtils;
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;
/**
import be.nikiroo.utils.MarkableFileInputStream;
/**
@@
-319,7
+320,7
@@
public class Cache {
if (!cached.exists() || isOld(cached, true)) {
InputStream imageIn = open(url, null, true);
if (!cached.exists() || isOld(cached, true)) {
InputStream imageIn = open(url, null, true);
- ImageIO.write(I
OUtils.toImage
(imageIn), Instance.getConfig()
+ ImageIO.write(I
mageUtils.fromStream
(imageIn), Instance.getConfig()
.getString(Config.IMAGE_FORMAT_CONTENT).toLowerCase(),
cached);
}
.getString(Config.IMAGE_FORMAT_CONTENT).toLowerCase(),
cached);
}
@@
-395,16
+396,21
@@
public class Cache {
*
* @param url
* the resource to open
*
* @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
*/
*
* @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 allow
Too
Old, boolean stable)
throws IOException {
File cached = getCached(url);
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));
}
return new MarkableFileInputStream(new FileInputStream(cached));
}