Class HeadDirectoryScanner

java.lang.Object
org.springframework.integration.file.DefaultDirectoryScanner
org.springframework.integration.file.HeadDirectoryScanner
All Implemented Interfaces:
DirectoryScanner

public class HeadDirectoryScanner extends DefaultDirectoryScanner
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 Details

    • HeadDirectoryScanner

      public HeadDirectoryScanner(int maxNumberOfFiles)
  • Method Details

    • setFilter

      public final void setFilter(FileListFilter<File> filter)
      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 interface DirectoryScanner
      Overrides:
      setFilter in class DefaultDirectoryScanner
      Parameters:
      filter - the custom filter to be used