Returns true if the file does not exist, or has been modified since the last time it was loaded.
@param file File to check
@return true if the file needs to be reloaded.
@throws IOException on io error
344924
public synchronized boolean needsReload(final File file) throws IOException {
        final long lastMod = file.lastModified();
        if (!file.exists()) {
            mtimes.remove(file);
        }
        final Long aLong = mtimes.get(file);
        return null == aLong || lastMod > aLong;
    }
675089
public static void delete(final @NonNull File file) throws IOException
	{
		if (file.isDirectory())
		{
			DeleteFileExtensions.deleteAllFiles(file);
		}
		else
		{
			String error = null;
			// If the file is not deleted
			if (!file.delete())
			{
				error = "Cannot delete the File " + file.getAbsolutePath() + ".";

				throw new IOException(error);

			}
		}
	}
879524
public static boolean newerThan(File file, File reference) {
		if (null == reference || false == reference.exists()) {
			return true;// 文件一定比一个不存在的文件新
		}
		return newerThan(file, reference.lastModified());
	}
109599
public boolean exists(final Path f) throws IOException {
		try {
			return (getFileStatus(f) != null);
		} catch (FileNotFoundException e) {
			return false;
		}
	}
1267244
private void resetFile(String file) {
    File f = new File(file);
    if (f.exists()) {
      JMetalLogger.logger.info("Already existing file " + file);

      if (f.isDirectory()) {
        JMetalLogger.logger.info("Deleting directory " + file);
        if (f.delete()) {
          JMetalLogger.logger.info("Directory successfully deleted.");
        } else {
          JMetalLogger.logger.info("Error deleting directory.");
        }
      } else {
        JMetalLogger.logger.info("Deleting file " + file);
        if (f.delete()) {
          JMetalLogger.logger.info("File successfully deleted.");
        } else {
          JMetalLogger.logger.info("Error deleting file.");
        }
      }
    } else {
      JMetalLogger.logger.info("File " + file + " does NOT exist.");
    }
  }
450393
public boolean isFresh(final String filename) {
        final FileSystem fileSystem = vertx.fileSystem();

        try {
            FileProps fileProps = fileSystem.propsBlocking(filename);
            LRUCache.CacheEntry<String, T> cacheEntry = cache.get(filename);
            final long lastModified = fileProps.lastModifiedTime();

            if (cacheEntry == null) {
                return false;
            }
            if (cacheEntry.isFresh(lastModified)) {
                return true;
            }
            // not fresh anymore, purge it
            cache.remove(filename);
            return false;
        } catch (RuntimeException e) {
            return false;
        }
    }
711865
public boolean containsFile(File f) {
		return unchangedFiles.contains(f) || newFiles.contains(f)
				|| updatedFiles.contains(f) || deletedFiles.contains(f)
				|| recursedDirectories.contains(f)
				|| failedTransfers.containsKey(f);
	}
224432
function fileExists(file) {
    var fileExists = true;

    try {
        fs.statSync(file, function(err, stat) {
            if (err == null) {
                fileExists = true;
            } else {
                fileExists = false;
            }
        });
    } catch (e) {
        fileExists = false;
    }

    return fileExists;
}
1005309
public void onFileChange(File file) {
        LOG.info("File updated : {}", file.getAbsolutePath());
        onFileDelete(file);
        onFileCreate(file);
    }
518832
protected boolean fileExists()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "fileExists", this);

        boolean fileAlreadyExists = true;

        File file = new File(_logDirectory, _fileName);
        fileAlreadyExists = (file.exists() && (file.length() > 0));

        if (tc.isEntryEnabled())
            Tr.exit(tc, "fileExists", new Boolean(fileAlreadyExists));
        return fileAlreadyExists;
    }
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;
	}
1371777
private function checkFileBeforeInitialize($directory, $file)
    {
        $filePath = $directory . '/' . $file;

        if (file_exists($filePath)) {
            throw new IOException(sprintf(
                'The file "%s" already exist.',
                $filePath
            ));
        }

        touch($filePath);
    }
187447
public static boolean newerThan(File file, long timeMillis) {
		if (null == file || false == file.exists()) {
			return false;// 不存在的文件一定比任何时间旧
		}
		return file.lastModified() > timeMillis;
	}
589639
public static void deleteAllFiles(final File file) throws IOException
	{
		String error = null;
		if (!file.exists())
		{
			return;
		}
		final Exception ex = checkFile(file);
		if (ex != null)
		{
			try
			{
				throw ex;
			}
			catch (final Exception e)
			{
				e.printStackTrace();
			}
		}
		DeleteFileExtensions.deleteFiles(file);
		if (!file.delete())
		{
			error = "Cannot delete the File " + file.getAbsolutePath() + ".";

			throw new IOException(error);

		}
	}
3249
private void checkForExistence(String fileName) throws IOException {
        File file = new File(fileName);
        if (!file.exists()) {
            throw new FileNotFoundException("File with name " + fileName + " does not exist.");
        }
        if (!file.isFile()) {
            throw new IOException("Provided string does not correspond to an actual file.");
        }

    }
325231
public void restoreFromFile(File file) throws IOException
    {
        byte[] rawData = new byte[(int) file.length()];
        ByteBuffer bufData = null;
        FileInputStream fis = null;
        DataInputStream dis = null;
        try {
            fis = new FileInputStream(file);
            dis = new DataInputStream(fis);
            dis.readFully(rawData);
            bufData = ByteBuffer.wrap(rawData);
            restoreFromBuffer(bufData);
        }
        finally {
            if (dis != null) {
                dis.close();
            }
            if (fis != null) {
                fis.close();
            }
        }
    }
266579
public boolean exists() throws IOException {
        boolean exists = false;
        try {
            // force lookup again
            setFileHandle(null);
            exists = (getFileHandle() != null);
        } catch (FileNotFoundException e) {
            // do nothing
        }
        return exists;
    }