/** * Creates a new instance of a <code>FileExtensionMatcher</code> that will * perform a match to this array of file extensions. * @param extension The array of file extensions to match against a File * @param caseSensitive If true the extension must match the case of the * provided extension, otherwise a case insensitive match will occur. * @throws IllegalArgumentException Thrown if the file extension is not * formatted correctly such as containing a period. */ public FileExtensionFilter(String[] extensions, boolean caseSensitive) throws IllegalArgumentException { // check each extension for (String ext : extensions) { if (!FileUtil.isValidFileExtension(ext)) { throw new IllegalArgumentException("Invalid file extension '" + ext + "' cannot be matched"); } } this.caseSensitive = caseSensitive; this.extensions = extensions; }
/** * Creates a new instance of a <code>FileExtensionMatcher</code> that will * perform a match to this array of file extensions. * @param extension The array of file extensions to match against a File * @param caseSensitive If true the extension must match the case of the * provided extension, otherwise a case insensitive match will occur. * @throws IllegalArgumentException Thrown if the file extension is not * formatted correctly such as containing a period. */ public FileExtensionFilter(String[] extensions, boolean caseSensitive) throws IllegalArgumentException { // check each extension for (String ext : extensions) { if (!FileUtil.isValidFileExtension(ext)) { throw new IllegalArgumentException("Invalid file extension '" + ext + "' cannot be matched"); } } this.caseSensitive = caseSensitive; this.extensions = extensions; }