@@ -0,0 +1,1282 @@
+package ihk.report.generator.util;%0A%0Aimport java.io.File;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class FileUtils %7B%0A%0A%09// TODO: unit test%0A%09public List%3CString%3E getFormatsInDir(File dir, List%3CString%3E formatsToCheck) %7B%0A%09%09%0A%09%09List%3CString%3E fileFormatsFound = new ArrayList%3CString%3E();%0A%09%09for (String format : formatsToCheck) %7B%0A%09%09%09for (File file : dir.listFiles()) %7B%0A%09%09%09%09// ignore directories%0A%09%09%09%09if (file.isDirectory()) %7B%0A%09%09%09%09%09continue;%0A%09%09%09%09%7D else if (fileFormatsFound.contains(format)) %7B%0A%09%09%09%09%09// skip all other checks for this format%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%09// end check if all formats found%0A%09%09%09%09if (fileFormatsFound.size() == formatsToCheck.size()) %7B%0A%09%09%09%09%09return fileFormatsFound;%0A%09%09%09%09%7D else if (file.getName().endsWith(format)) %7B%0A%09%09%09%09%09fileFormatsFound.add(format);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09// make sure to return null if no relevant formats found%0A%09%09fileFormatsFound = fileFormatsFound.isEmpty() ? null : fileFormatsFound;%0A%09%09return fileFormatsFound;%0A%09%7D%0A%09%0A%09// TODO: unit test%0A%09public List%3CFile%3E getFilesByFormat(File dir, String format) %7B%0A%09%09%0A%09%09List%3CFile%3E filesFound = new ArrayList%3CFile%3E();%0A%09%09for (File file : dir.listFiles()) %7B%0A%09%09%09if (file.isDirectory() %7C%7C !file.getName().endsWith(format)) %7B%0A%09%09%09%09continue;%0A%09%09%09%7D else %7B%0A%09%09%09%09filesFound.add(file);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return filesFound;%0A%09%7D %0A%7D%0A

add FileUtils.java