Improve remote, fix bugs, update nikiroo-utils
[nikiroo-utils.git] / src / be / nikiroo / fanfix / DataLoader.java
index ef115c9d60a9b647147fe3dff06c9bf5d95a6283..e4f40a30289548069c9fb6a4c3b4c17d6136bdc2 100644 (file)
@@ -231,6 +231,8 @@ public class DataLoader {
                        ImageIO.write(ImageUtils.fromStream(in), Instance.getConfig()
                                        .getString(Config.IMAGE_FORMAT_CONTENT).toLowerCase(),
                                        target);
+               } catch (IOException e) {
+                       throw new IOException("Cannot write image " + url, e);
                } finally {
                        in.close();
                }
@@ -266,6 +268,18 @@ public class DataLoader {
                return cache.load(uniqueID, true, true);
        }
 
+       /**
+        * Remove the given resource from the cache.
+        * 
+        * @param uniqueID
+        *            a unique ID used to locate the cached resource
+        * 
+        * @return TRUE if it was removed
+        */
+       public boolean removeFromCache(String uniqueID) {
+               return cache.remove(uniqueID);
+       }
+
        /**
         * Clean the cache (delete the cached items).
         *