Test if name of the file matches this filter pattern. Returns false if <code>file</code> argument is null.

@param file the file to check, null accepted.
@return true if name of the file matches this filter pattern.
513562
@Override
	public boolean accept(File file) {
		return file != null ? match(file.getName(), pattern) : false;
	}
269250
public static void checkValidFile(final File file) {
        checkNotNull("file", file);
        if (!file.exists()) {
            throw new IllegalArgumentException("The file '" + file + "' does not exist!");
        }
        if (!file.isFile()) {
            throw new IllegalArgumentException("The name '" + file + "' is not a file!");
        }
    }
1308709
function isIgnoredFile(file) {
    if (options.ignore !== undefined) {
      var result = false;

      options.ignore.forEach(function(pattern) {
        if (minimatch(file, pattern)) {
          result = true;
          return false;
        }
      });

      return result;
    }

    return false;
  }
177441
protected boolean doesFileMatch(final File file, final CSNodeWrapper node) {
        if (!node.getNodeType().equals(CommonConstants.CS_NODE_FILE)) return false;

        // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare
        if (file.getUniqueId() != null && file.getUniqueId().matches("^\\d.*")) {
            return file.getUniqueId().equals(Integer.toString(node.getId()));
        } else {
            // Since a content spec doesn't contain the database ids for the nodes use what is available to see if the files match
            return file.getId().equals(node.getEntityId());
        }
    }
763898
public static List<File> findAllFile(File file) {
        if (file == null || !file.exists()) {
            return Collections.emptyList();
        }

        if (file.isFile()) {
            return Collections.singletonList(file);
        }

        List<File> fileList = new ArrayList<>();
        File[] files = file.listFiles();
        for (File f : files) {
            fileList.addAll(findAllFile(f));
        }

        return fileList;
    }
751758
public static boolean isSnapshotFile(File file) {
    checkNotNull(file, "file cannot be null");
    String fileName = file.getName();

    // The file name should contain an extension separator.
    if (fileName.lastIndexOf(EXTENSION_SEPARATOR) == -1) {
      return false;
    }

    // The file name should end with the snapshot extension.
    if (!fileName.endsWith("." + EXTENSION)) {
      return false;
    }

    // Parse the file name parts.
    String[] parts = fileName.substring(0, fileName.lastIndexOf(EXTENSION_SEPARATOR)).split(String.valueOf(PART_SEPARATOR));

    // The total number of file name parts should be at least 2.
    if (parts.length < 2) {
      return false;
    }

    // The second part of the file name should be numeric.
    // Subtract from the number of parts to ensure PART_SEPARATOR can be used in snapshot names.
    if (!isNumeric(parts[parts.length - 1])) {
      return false;
    }

    // Otherwise, assume this is a snapshot file.
    return true;
  }
1375051
public static boolean isInDirectory(File file, File directory) {
        try {
            return FilenameUtils.directoryContains(directory.getCanonicalPath(), file.getCanonicalPath());
        } catch (IOException e) { //NOSONAR
            return false;
        }
    }
296275
boolean checkFile( File file )
    {
        if ( file == null )
        {
            //if we get here and it's null, treat it as a success.
            return true;
        }

        // check the file now
        if ( file.exists() )
        {
            long length = file.length();
            if ( length < minsize )
            {
                this.errorMsg = ( file + " size (" + length + ") too small. Min. is " + minsize );
                return false;
            }
            else if ( length > maxsize )
            {
                this.errorMsg = ( file + " size (" + length + ") too large. Max. is " + maxsize );
                return false;
            }
            else
            {

                this.log.debug( file
                    + " size ("
                    + length
                    + ") is OK ("
                    + ( minsize == maxsize || minsize == 0 ? ( "max. " + maxsize )
                                    : ( "between " + minsize + " and " + maxsize ) ) + " byte)." );

                return true;
            }
        }
        else
        {
            this.errorMsg = ( file + " does not exist!" );
            return false;
        }
    }
634494
public boolean matchesFilter(String filter) {

        filter = filter.toLowerCase();
        return getTitle().toLowerCase().contains(filter) || m_path.toLowerCase().contains(filter);
    }
494430
public boolean fileMatchesRules(File file) {

        try {
            if(file.exists()) {
                if(includeFilesContainingText.length == 0 && excludeFilesContainingText.length == 0) {
                    return fileMatchesRules(
							getComparableFileName(file));
                } else {
                    return fileMatchesRules(
							getComparableFileName(file),
                            FileSupport.getTextFileFromFS(file));
                }
            }
        } catch (IOException ioe) {
            //at the moment file does not match rules
        }
		return false;
	}
1138260
public boolean accept(File file) {
        if (caseSensitive) {
            return file.getName().startsWith(string0);
        } else {
            return file.getName().toLowerCase().startsWith(string0.toLowerCase());
        }
    }
1301840
public boolean filterDirectory(File file)
    {
        boolean bProcessFile = super.filterDirectory(file);
        if (bProcessFile == false)
            return bProcessFile;
        String strName = file.getName();
        for (String strMonth : m_rgstrMonths)
        {
            if (strName.equalsIgnoreCase(strMonth))
                return false;
        }
        if (Utility.isNumeric(strName))
        {
            int iYear = Integer.parseInt(strName);
            if ((iYear > 1990) && (iYear < 2020))
                return false;
        }
        return bProcessFile;
    }
488166
public boolean accept(File f) {
        if (f != null) {
            if (f.isDirectory()) {
                return false;
            }
            String extension = getExtension(f);
            if (extension != null && filters.get(getExtension(f)) != null) {
                return true;
            }
        }
        return false;
    }
743462
public boolean accept(File file) {
    Matcher m = pattern.matcher(file.getName());
    return m.matches();
  }
1322754
public boolean matchesFilter(String filter) {

        filter = filter.toLowerCase();
        return m_title.toLowerCase().contains(filter) || m_path.toLowerCase().contains(filter);
    }
809960
@Override
    public boolean accept(File file) {
        String name = file.getName();
        if (FilenameUtils.wildcardMatch(name, wildcards, caseSensitivity)) {
            return true;
        }
        return false;
    }
887330
public static boolean exists(File file) {
        try {
            boolean fileExists = file.exists();
            if(!forceCaseSensitive || !fileExists) {
                return fileExists;
            }

            String absPath = canonicalize(file.getAbsolutePath());
            String canPath = canonicalize(file.getCanonicalPath());
            return fileExists && absPath.equals(canPath);
        } catch(IOException io) {
            return false;
        }
    }