Determines if the file should be recorded based on the given
configuration. Note that additional filtering may happen in monitor(s),
e.g., temp files.

@param file
File name to check
@return True if file should be recorded, false otherwise
199462
protected boolean isRelevant(String file) {
        if (mExcludes != null && mExcludes.matcher(file).find()) {
            return false;
        }
        if (mIncludes != null && !mIncludes.matcher(file).find()) {
            return false;
        }
        return true;
    }
47573
public static boolean canReadFile(File file) {		
		if(file!=null && file.canRead() && !file.isDirectory()){
			return true;
		} else {
			return false;
		}		
	}
259691
public static boolean isFile(Resource file) {
	if (file.exists()) return file.isFile();
	Resource parent = file.getParentResource();
	return parent.mkdirs() && file.createNewFile();
    }
1058549
@Override
    public boolean fileDeleted(File file) {
        File output = getOutputFile(file, OUTPUT_EXTENSION);
        FileUtils.deleteQuietly(output);
        return true;
    }
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;
  }
755086
private void determineChangesSince(File file, long lastScanTime) {
		try {
			if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) {
				log.info("Firing file changed event " + file);
			}
			listener.fileChanged(file);
			if (file.isDirectory()) {
				File[] filesOfInterest = file.listFiles(new RecentChangeFilter(lastScanTime));
				for (File f : filesOfInterest) {
					if (f.isDirectory()) {
						determineChangesSince(f, lastScanTime);
					}
					else {
						if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) {
							log.info("Observed last modification time change for " + f + "  (lastScanTime="
									+ lastScanTime + ")");
							log.info("Firing file changed event " + file);
						}
						listener.fileChanged(f);
					}
				}
			}
		}
		catch (Throwable t) {
			if (log.isLoggable(Level.SEVERE)) {
				log.log(Level.SEVERE, "FileWatcher caught serious error, see cause", t);
			}
		}
	}
1131022
public void saveSettings(String file) throws IOException {
        Path path = Paths.get(file);

        try (BufferedWriter reader = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
            Properties props = new Properties();
            saveSettings(props);
            props.store(reader, "Saved by LiveConstantTweaker");
        }
    }
664690
public void setFile(File file) throws IOException {
        if(!file.isFile())
            throw new IllegalArgumentException(file+" must be a file.");
        else {
            if(file.getName().endsWith("gz"))
                initGzReader(file);
            else
                initReader(file);
        }
    }
1005309
public void onFileChange(File file) {
        LOG.info("File updated : {}", file.getAbsolutePath());
        onFileDelete(file);
        onFileCreate(file);
    }
809960
@Override
    public boolean accept(File file) {
        String name = file.getName();
        if (FilenameUtils.wildcardMatch(name, wildcards, caseSensitivity)) {
            return true;
        }
        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;
        }
    }
871168
@Override
    public boolean accept(File file) {
        //All directories are added in the least that can be read by the Application
        if (file.isDirectory()&&file.canRead())
        {   return true;
        }
        else if(properties.selection_type==DialogConfigs.DIR_SELECT)
        {   /*  True for files, If the selection type is Directory type, ie.
             *  Only directory has to be selected from the list, then all files are
             *  ignored.
             */
            return false;
        }
        else
        {   /*  Check whether name of the file ends with the extension. Added if it
             *  does.
             */
            String name = file.getName().toLowerCase(Locale.getDefault());
            for (String ext : validExtensions) {
                if (name.endsWith(ext)) {
                    return true;
                }
            }
        }
        return false;
    }
180101
protected void check(File file) throws IOException {
        if(!file.exists()) {
            throw new FileNotFoundException(file.getAbsolutePath());
        }
        
        if(file.isDirectory()) {
            throw new IOException("Cannot open directory " + file.getAbsolutePath());
        }
    }
1067330
public void setPersistedFile(File file) throws FileNotFoundException
   {
      if (file instanceof SwapFile)
      {
         ((SwapFile)file).acquire(this);
      }

      this.file = file;

      // JCR-2326 Release the current ValueData from tempFile users before
      // setting its reference to null so it will be garbage collected.
      if (this.tempFile != null)
      {
         this.tempFile.release(this);
         this.tempFile = null;
      }

      this.stream = null;
   }
591174
public static boolean deleteRecursive(final File file) {
		boolean result = true;
		if (file.isDirectory()) {
			for (final File inner : file.listFiles()) {
				result &= deleteRecursive(inner);
			}
		}
		return result & file.delete();
	}
1239716
public static boolean deleteFile(File file) throws IOException {
		if (file.isDirectory()) {
			throw new IOException("File " + file + " isn't a file.");
		}
		if (!file.delete()) {
			if (System.getProperty("os.name").equalsIgnoreCase("windows")) {
				file = file.getCanonicalFile();
				System.gc();
			}
			try {
				Thread.sleep(10);
				return file.delete();
			} catch (InterruptedException ex) {
				return file.delete();
			}
		}
		return true;
	}
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());
        }
    }