public class DefaultDirectoryScanner extends Object implements DirectoryScanner
| Constructor and Description |
|---|
DefaultDirectoryScanner()
Initializes
filter with a default list of
FileListFilters using a CompositeFileListFilter:
IgnoreHiddenFileListFilter
AcceptOnceFileListFilter
|
| Modifier and Type | Method and Description |
|---|---|
protected FileListFilter<File> |
getFilter() |
protected FileLocker |
getLocker() |
protected File[] |
listEligibleFiles(File directory)
Subclasses may refine the listing strategy by overriding this method.
|
List<File> |
listFiles(File directory)
Scans the directory according to the strategy particular to this
implementation and returns the selected files as a File array.
|
void |
setFilter(FileListFilter<File> filter)
Sets a custom filter to be used by this scanner.
|
void |
setLocker(FileLocker locker)
Sets a custom locker to be used by this scanner.
|
boolean |
tryClaim(File file)
This class takes the minimal implementation and merely delegates to the locker if set.
|
public void setFilter(FileListFilter<File> filter)
DirectoryScannersetFilter in interface DirectoryScannerfilter - the custom filter to be usedprotected FileListFilter<File> getFilter()
public final void setLocker(FileLocker locker)
DirectoryScannersetLocker in interface DirectoryScannerlocker - the custom locker to be usedprotected FileLocker getLocker()
public boolean tryClaim(File file)
tryClaim in interface DirectoryScannerfile - the file to try to claim.public List<File> listFiles(File directory) throws IllegalArgumentException
DirectoryScannerlistFiles in interface DirectoryScannerdirectory - the directory to scan for filesIllegalArgumentException - if the input is incorrect