Interface IFileFilter

All Superinterfaces:
FileFilter, FilenameFilter, Predicate<File>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IFileFilter extends FileFilter, FilenameFilter, Predicate<File>
Abstract interface that collects FileFilter, FilenameFilter and Predicate.
Author:
Philip Helger
  • Method Details

    • accept

      default boolean accept(@Nullable File aFile)
      Accept a file. Delegates to Predicate.test(Object).
      Specified by:
      accept in interface FileFilter
      Parameters:
      aFile - The file to check. May be null.
      Returns:
      true if the file is accepted, false otherwise.
    • accept

      default boolean accept(@Nullable File aDir, @Nullable String sName)
      Accept a file based on directory and name. Delegates to Predicate.test(Object).
      Specified by:
      accept in interface FilenameFilter
      Parameters:
      aDir - The parent directory. May be null.
      sName - The filename. May be null.
      Returns:
      true if the file is accepted, false otherwise.
    • directoryOnly

      static @NonNull IFileFilter directoryOnly()
      Returns:
      The created IFileFilter. Never null.
    • directoryPublic

      static @NonNull IFileFilter directoryPublic()
      Returns:
      The created IFileFilter. Never null.
    • parentDirectoryPublic

      static @NonNull IFileFilter parentDirectoryPublic()
      Returns:
      The created IFileFilter. Never null.
    • fileOnly

      static @NonNull IFileFilter fileOnly()
      Returns:
      The created IFileFilter. Never null.
    • filenameHidden

      static @NonNull IFileFilter filenameHidden()
      Returns:
      The created IFileFilter. Never null.
    • filenameStartsWith

      static @NonNull IFileFilter filenameStartsWith(@Nonempty @NonNull @Nonempty String sPrefix)
      Parameters:
      sPrefix - The extension to use. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
    • filenameEndsWith

      static @NonNull IFileFilter filenameEndsWith(@Nonempty @NonNull @Nonempty String sSuffix)
      Parameters:
      sSuffix - The suffix to use. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
    • filenameEquals

      static @NonNull IFileFilter filenameEquals(@Nonempty @NonNull @Nonempty String sFilename)
      Parameters:
      sFilename - The filename to use. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
    • filenameEqualsIgnoreCase

      static @NonNull IFileFilter filenameEqualsIgnoreCase(@Nonempty @NonNull @Nonempty String sFilename)
      Parameters:
      sFilename - The filename to use. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
    • filenameNotEquals

      static @NonNull IFileFilter filenameNotEquals(@Nonempty @NonNull @Nonempty String sFilename)
      Parameters:
      sFilename - The filename to use. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
    • filenameNotEqualsIgnoreCase

      static @NonNull IFileFilter filenameNotEqualsIgnoreCase(@Nonempty @NonNull @Nonempty String sFilename)
      Parameters:
      sFilename - The filename to use. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
    • filenameMatchAnyRegEx

      static @NonNull IFileFilter filenameMatchAnyRegEx(@Nonempty @NonNull @Nonempty String... aRegExs)
      Create a file filter that matches, if it matches one of the provided regular expressions
      Parameters:
      aRegExs - The regular expressions to match against. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
      See Also:
    • filenameMatchNoRegEx

      static @NonNull IFileFilter filenameMatchNoRegEx(@Nonempty @NonNull @Nonempty String... aRegExs)
      Create a file filter that matches, if it matches none of the provided regular expressions
      Parameters:
      aRegExs - The regular expressions to match against. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
      See Also:
    • filenameMatchAny

      static @NonNull IFileFilter filenameMatchAny(@Nonempty @NonNull @Nonempty String... aFilenames)
      Create a file filter that matches, if it matches one of the provided filenames.
      Parameters:
      aFilenames - The names to match against. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
      See Also:
    • filenameMatchNone

      static @NonNull IFileFilter filenameMatchNone(@Nonempty @NonNull @Nonempty String... aFilenames)
      Create a file filter that matches, if it matches none of the provided filenames.
      Parameters:
      aFilenames - The filenames to match against. May neither be null nor empty.
      Returns:
      The created IFileFilter. Never null.
      See Also: