Class RecursiveDirectoryScanner
java.lang.Object
org.springframework.integration.file.DefaultDirectoryScanner
org.springframework.integration.file.RecursiveDirectoryScanner
- All Implemented Interfaces:
DirectoryScanner
public class RecursiveDirectoryScanner extends DefaultDirectoryScanner
The
DefaultDirectoryScanner
extension which walks through the directory tree
using Files.walk(Path, int, FileVisitOption...)
.
By default this class visits all levels of the file tree without any FileVisitOption
s.
- Since:
- 5.0
- Author:
- Artem Bilan, Gary Russell
- See Also:
Files.walk(java.nio.file.Path, int, java.nio.file.FileVisitOption...)
-
Constructor Summary
Constructors Constructor Description RecursiveDirectoryScanner()
-
Method Summary
Modifier and Type Method Description 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
setFileVisitOptions(FileVisitOption... fileVisitOptions)
The options to configure the traversal.void
setMaxDepth(int maxDepth)
The maximum number of directory levels to visit.Methods inherited from class org.springframework.integration.file.DefaultDirectoryScanner
getFilter, getLocker, listEligibleFiles, setFilter, setLocker, tryClaim
-
Constructor Details
-
RecursiveDirectoryScanner
public RecursiveDirectoryScanner()
-
-
Method Details
-
setMaxDepth
public void setMaxDepth(int maxDepth)The maximum number of directory levels to visit.- Parameters:
maxDepth
- the maximum number of directory levels to visit
-
setFileVisitOptions
The options to configure the traversal.- Parameters:
fileVisitOptions
- options to configure the traversal
-
listFiles
Description copied from interface:DirectoryScanner
Scans the directory according to the strategy particular to this implementation and returns the selected files as a File array. This method may never return files that are rejected by the filter.- Specified by:
listFiles
in interfaceDirectoryScanner
- Overrides:
listFiles
in classDefaultDirectoryScanner
- Parameters:
directory
- the directory to scan for files- Returns:
- a list of files representing the content of the directory
- Throws:
IllegalArgumentException
- if the input is incorrect
-