Checks if file matches rules.
@param file
@return true if a file exists, matches include and exclude rules and is successfully parsed in case of inspection of contents
@throws IOException
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;
	}
736752
public static boolean createNewFile(File file) throws IOException {
        createFolder(file.getParent());
        return (!file.exists() || file.delete()) && file.createNewFile();
    }
5635
private void includeFile(File file)
        throws IOException
    {
        if (!file.exists())
            throw new FileNotFoundException(file.toString());
        
        if (file.isDirectory())
        {
            List list = new List(List.Unordered);       
            String[] ls = file.list();
            for (int i=0 ; i< ls.length ; i++)
                list.add(ls[i]);
            StringWriter sw = new StringWriter();
            list.write(sw);
            reader = new StringReader(sw.toString());
        }
        else
        {
            reader = new BufferedReader(new FileReader(file));
        }
    }
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;
        }
    }
86430
function shouldBeIncluded(file) {

  if (!showAllFiles && file[0] === '.') {
    return false
  }
  if (hasExcludePattern) {
    return !excludePattern.test(file)
  }
  if (hasIncludePattern) {
    return includePattern.test(file)
  }
  return true
}
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;
  }
440887
@Override
    public boolean matches(Source src) {
        String name = src.getOrigin().getName().toLowerCase();
        String[] extensions = getInputFileExtensions();
        if (extensions.length == 1) {
            return FilenameUtils.isExtension(name, extensions[0]);
        }

        return FilenameUtils.isExtension(name, extensions);
    }
706066
def check(self, file):
        
        result = []
        for rule in self.ruleset:
            matches = rule.match(file)
            for match in matches:
                result.append(str(match))

        return result
748863
public static File exists(File file) {
		Validate.notNull(file);
		if(!file.exists())
			throw new ParameterException("\""+file+"\" does not exist!");
		return file;
	}
809960
@Override
    public boolean accept(File file) {
        String name = file.getName();
        if (FilenameUtils.wildcardMatch(name, wildcards, caseSensitivity)) {
            return true;
        }
        return false;
    }
325615
private static boolean isJarFile(File file) {
		if (false == FileUtil.isFile(file)) {
			return false;
		}
		return file.getPath().toLowerCase().endsWith(".jar");
	}
983922
@Override
    public boolean accept(File file) {
        WildcardFileFilter filter = new WildcardFileFilter(watchFilter);
        return filter.accept(file);
    }
438277
private boolean isFile(FTPClient client, Path file) {
    try {
      return !getFileStatus(client, file).isDir();
    } catch (FileNotFoundException e) {
      return false; // file does not exist
    } catch (IOException ioe) {
      throw new FTPException("File check failed", ioe);
    }
  }
647946
public static boolean hasGeoPackageExtension(File file) {
		String extension = GeoPackageIOUtils.getFileExtension(file);
		boolean isGeoPackage = extension != null
				&& (extension
						.equalsIgnoreCase(GeoPackageConstants.GEOPACKAGE_EXTENSION) || extension
						.equalsIgnoreCase(GeoPackageConstants.GEOPACKAGE_EXTENDED_EXTENSION));
		return isGeoPackage;
	}
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());
        }
    }
745772
public static void validateZip(File file) throws IOException {
    ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file));
    ZipEntry zipEntry = zipInput.getNextEntry();

    while (zipEntry != null) {
      zipEntry = zipInput.getNextEntry();
    }

    try {
      if (zipInput != null) {
        zipInput.close();
      }
    } catch (IOException e) {
    }
  }
112082
private static boolean isValidJavaClassFile(String file) {
        if (!file.endsWith(".class")) return false;
        String clazzName = file.substring(0, file.length() - ".class".length());
        return isValidClassName(clazzName);
    }