# Class: com.pnfsoftware.jeb.util.io.DirectoryEnumerator

List \(full in\-memory enumeration\) or iterate over a directory contents, with support for recursion and regex file filters. The returned File Objects are real [File](File)s passing the `File.isFile()` test.

## Constructor: DirectoryEnumerator
- parameter: `base`, type: `java.io.File`
- parameter: `filterString`, type: `java.lang.String`
- parameter: `recurse`, type: `boolean`

Description: Create a new directory enumerator.
parameter: base: base folder
parameter: filterString: optional wildcard filter string for filenames; to use a full regex            pattern, provide null for this parameter and use [#setFilter(Pattern)](#setFilter(Pattern)) after            construction
parameter: recurse: true to recursively enumerate sub\-directories.
throws: on initialization error

## Constructor: DirectoryEnumerator
- parameter: `base`, type: `java.io.File`

Description: Create a new directory enumerator. The enumerator is filter\-less \(it matches on all files\) and does not recurse over sub\-directories.
parameter: base: base folder

## Method: addBlackListedDirectory
- parameter: `dirname`, type: `java.lang.String`

Description: Record a simple directory name \(not path\) that should not be recursively explored. Ignored if the enumerator is not recursive. The base directory is always explored, even if its simple name is blacklisted. 

 Example: 'xyz' is blacklisted, the search is recursive and starts in '/xyz':
 \- "/xyz/..." is explored, no matter what
 \- if it exists, "/xyz/xyz/..." and its sub\-dirs WONT be explored
 \- if it exists, "/xyz/0/1/xyz/..." and its sub\-dirs WONT be explored
 \- if it exists, file named '/xyz/xyz' or /xyz/foo/xyz" WILL be returned.
parameter: dirname: simple directory name to skip during recursion

## Method: getBlacklistedDirnames
- return type: `java.util.Collection<java.lang.String>`

Description: Get the directory names skipped during recursive enumeration.
return: unmodifiable collection of blacklisted simple directory names

## Method: getFilter
- return type: `java.util.regex.Pattern`

Description: Get the active regex filter.
return: regex pattern, or null if no filter is active

## Method: isRecurse
- return type: `boolean`

Description: Determine whether recursive enumeration is enabled.
return: true if subdirectories are recursively explored

## Method: iterator
- return type: `java.util.Iterator<java.io.File>`


## Method: list
- return type: `java.util.List<java.io.File>`

Description: Browse the folder\(s\) and retrieve the matching files.
return: a list of files

## Method: setFilter
- parameter: `pattern`, type: `java.util.regex.Pattern`

Description: Set a regex pattern to select files. 

 Example: `".*\\.(exe|dll)$"` will match all Windows executables and dynamic libraries.
parameter: pattern: optional regex pattern, null to disable

## Method: setFilterString
- parameter: `filterString`, type: `java.lang.String`
- parameter: `matchCaseInsensitive`, type: `boolean`
- parameter: `matchUnicode`, type: `boolean`

Description: Set a wildcard filename filter.
parameter: filterString: non\-null filter string; to disable filters, use            [#setFilter(Pattern)](#setFilter(Pattern))
parameter: matchCaseInsensitive: true to match case\-insensitively
parameter: matchUnicode: true to enable Unicode character classes

## Method: setRecurse
- parameter: `recurse`, type: `boolean`

Description: Enable or disable recursive enumeration.
parameter: recurse: true to recurse into subdirectories

