/** * Accepts a File by its file extension. * @param file The file to match * @return True if the File matches this the array of acceptable file * extensions. */ public boolean accept(File file) { // extract this file's extension String fileExt = FileUtil.parseFileExtension(file.getName()); // a file extension might not have existed if (fileExt == null) { // if no file extension extracted, this definitely is not a match return false; } // does it match our list of acceptable file extensions? for (String extension : extensions) { if (caseSensitive) { if (fileExt.equals(extension)) { return true; } } else { if (fileExt.equalsIgnoreCase(extension)) { return true; } } } // if we got here, then no match was found return false; }
/** * Accepts a File by its file extension. * @param file The file to match * @return True if the File matches this the array of acceptable file * extensions. */ public boolean accept(File file) { // extract this file's extension String fileExt = FileUtil.parseFileExtension(file.getName()); // a file extension might not have existed if (fileExt == null) { // if no file extension extracted, this definitely is not a match return false; } // does it match our list of acceptable file extensions? for (String extension : extensions) { if (caseSensitive) { if (fileExt.equals(extension)) { return true; } } else { if (fileExt.equalsIgnoreCase(extension)) { return true; } } } // if we got here, then no match was found return false; }
String fileExt = FileUtil.parseFileExtension(sourceFile.getName());
String fileExt = FileUtil.parseFileExtension(sourceFile.getName());