fitgoodies-core/src/main/java/de/cologneintelligence/fitgoodies/file/FileSelector.java
public File getUniqueFile()
			throws FilenameNotUniqueException, FileNotFoundException {
		File[] files = directory.listFiles(filter);

		if (files == null || files.length == 0) {
			throw new FileNotFoundException();
		}

		if (files.length > 1) {
			throw new FilenameNotUniqueException(filter.getPattern());
		}
		return files[0];
	}
public File getUniqueFile()
			throws FilenameNotUniqueException, FileNotFoundException {
		File[] files = directory.listFiles(filter);

		if (files == null || files.length == 0) {
			throw new FileNotFoundException();
		}

		if (files.length > 1) {
			throw new FilenameNotUniqueException(filter.getPattern());
		}
		return files[0];
	}
public File getUniqueFile ( ) throws FilenameNotUniqueException , FileNotFoundException { File [ ] files = directory . listFiles ( filter ) ; if ( files == null || files . length == 0 ) { throw new FileNotFoundException ( ) ; } if ( files . length > 1 ) { throw new FilenameNotUniqueException ( filter . getPattern ( ) ) ; } return files [ 0 ] ; }
Returns the only file that matches the pattern. If no file matches, a
<code>null</code>. If more than one file matches, a
{@link FilenameNotUniqueException} is thrown.

@return the matching file or <code>null</code> if no file matched
@throws FilenameNotUniqueException more than one file matched the pattern
@throws FileNotFoundException      thrown, if the directory does not exist.
Returns the only file that matches the pattern . If no file matches a <code > null< / code > . If more than one file matches a { @link FilenameNotUniqueException } is thrown .