public class DefaultDirectoryScanner extends java.lang.Object implements DirectoryScanner
Constructor and Description |
---|
DefaultDirectoryScanner()
Initializes
filter with a default list of
FileListFilter s using a CompositeFileListFilter :
IgnoreHiddenFileListFilter
AcceptOnceFileListFilter
|
Modifier and Type | Method and Description |
---|---|
protected FileListFilter<java.io.File> |
getFilter() |
protected FileLocker |
getLocker() |
protected java.io.File[] |
listEligibleFiles(java.io.File directory)
Subclasses may refine the listing strategy by overriding this method.
|
java.util.List<java.io.File> |
listFiles(java.io.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<java.io.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(java.io.File file)
This class takes the minimal implementation and merely delegates to the locker if set.
|
public void setFilter(FileListFilter<java.io.File> filter)
DirectoryScanner
setFilter
in interface DirectoryScanner
filter
- the custom filter to be usedprotected FileListFilter<java.io.File> getFilter()
public final void setLocker(FileLocker locker)
DirectoryScanner
setLocker
in interface DirectoryScanner
locker
- the custom locker to be usedprotected FileLocker getLocker()
public boolean tryClaim(java.io.File file)
tryClaim
in interface DirectoryScanner
file
- the file to try to claim.public java.util.List<java.io.File> listFiles(java.io.File directory) throws java.lang.IllegalArgumentException
DirectoryScanner
listFiles
in interface DirectoryScanner
directory
- the directory to scan for filesjava.lang.IllegalArgumentException
- if the input is incorrectprotected java.io.File[] listEligibleFiles(java.io.File directory)
directory
- root directory to use for listing