Class HeadDirectoryScanner
java.lang.Object
org.springframework.integration.file.DefaultDirectoryScanner
org.springframework.integration.file.HeadDirectoryScanner
- All Implemented Interfaces:
DirectoryScanner
A custom scanner that only returns the first
maxNumberOfFiles
elements from a directory listing. This is useful to limit the number of File
objects in memory and therefore mutually exclusive with AcceptOnceFileListFilter
.
It should not be used in conjunction with an AcceptOnceFileListFilter
.- Since:
- 2.0
- Author:
- Iwein Fuld, Gary Russell
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
setFilter
(FileListFilter<File> filter) Sets a custom filter to be used by this scanner.Methods inherited from class org.springframework.integration.file.DefaultDirectoryScanner
getFilter, getLocker, listEligibleFiles, listFiles, setLocker, tryClaim
-
Constructor Details
-
HeadDirectoryScanner
public HeadDirectoryScanner(int maxNumberOfFiles)
-
-
Method Details
-
setFilter
Description copied from interface:DirectoryScanner
Sets a custom filter to be used by this scanner. The filter will get a chance to reject files before the scanner presents them through its listFiles method. A scanner may use additional filtering that is out of the control of the provided filter.- Specified by:
setFilter
in interfaceDirectoryScanner
- Overrides:
setFilter
in classDefaultDirectoryScanner
- Parameters:
filter
- the custom filter to be used
-