/*
* Meviz - Various tools collection to work with multimedia.
* Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
public class Utils {
- private static File lastLoadedFile;
-
- private static BufferedImage lastLoadedBufferedImage;
-
/**
* Load image into {@link BufferedImage} and return it. Caches last loaded
* image to speed up subsequent loading attempts.
- *
+ *
* @throws ImageFormatError
* @throws IOException
*/
lastLoadedBufferedImage = ImageIO.read(file);
lastLoadedFile = file;
- if (lastLoadedBufferedImage == null)
+ if (lastLoadedBufferedImage == null) {
+ System.out.println("Error reading image: " + file);
throw new ImageFormatError("File: " + file
+ " is not a valid image.");
+ }
+
return lastLoadedBufferedImage;
}
}
public static File getThumbnailsDirectory(final File directoryToIndex) {
- return new File(directoryToIndex.getAbsolutePath() + "/"
- + Constants.THUMBNAILS_DIRECTORY_NAME + "/");
+ return new File(getThumbnailsDirectoryPath(directoryToIndex));
+ }
+
+ public static String getThumbnailsDirectoryPath(final File directoryToIndex) {
+ return directoryToIndex.getAbsolutePath() + "/"
+ + Constants.THUMBNAILS_DIRECTORY_NAME + "/";
}
public static boolean isMevizGeneratedIndexFile(final File indexFile)
return isMevizFile;
}
+ private static File lastLoadedFile;
+
+ private static BufferedImage lastLoadedBufferedImage;
+
}