4,7 → 4,6 |
import java.util.HashMap; |
import java.util.Comparator; |
import java.util.Arrays; |
import java.io.*; // FIXME |
import java.io.File; |
import java.io.FileFilter; |
import java.io.IOException; |
11,6 → 10,8 |
import java.io.FileInputStream; |
import java.io.FileOutputStream; |
import java.io.OutputStream; |
import java.io.BufferedReader; |
import java.io.InputStreamReader; |
import java.awt.Image; |
import java.awt.Toolkit; |
import java.awt.Graphics; |
176,6 → 177,17 |
buildCache(imagesRoot); |
} |
|
public void reloadCache() |
throws IOException |
{ |
logger.info("reload cache"); |
|
smallCache.clear(); |
mediumCache.clear(); |
dirCache.clear(); |
loadCaches(cacheDir); |
} |
|
protected void deleteCache(File dir) |
throws IOException |
{ |
342,10 → 354,17 |
"unknown type of cached " + file.getCanonicalPath()); |
} |
|
if(origin != null && cache != null) |
if(origin != null && cache != null) { |
loadCacheInfo(file, origin, cache); |
} |
else { |
file.delete(); |
|
if(logger.isDebugEnabled()) |
logger.debug("deleted (unknown origin)"); |
} |
} |
|
protected void loadCacheInfo(File file, File origin, Map cache) |
throws IOException |
{ |
379,8 → 398,6 |
|
if(children == null) return; // the dir does not exists |
|
Arrays.sort(children, fileNameComparator); |
|
for(int i = 0; i < children.length; i++) { |
if(children[i].isDirectory()) |
loadCaches(children[i]); |