判断文件是否被改动<br>
如果文件对象为 null 或者文件不存在，被视为改动

@param file 文件对象
@param lastModifyTime 上次的改动时间
@return 是否被改动
171462
public static boolean isModifed(File file, long lastModifyTime) {
		if (null == file || false == file.exists()) {
			return true;
		}
		return file.lastModified() != lastModifyTime;
	}
713421
public static @Nullable FileBinaryResource createOrNull(File file) {
    return (file != null) ? new FileBinaryResource(file) : null;
  }
788679
private long getLastModifiedTime(List<?> fileLists) {
    long lastModified = 0;

    for (Object entry : fileLists) {
      if (entry instanceof FileList) {
        FileList list = (FileList) entry;

        for (String fileName : list.getFiles(this.getProject())) {
          File path = list.getDir(this.getProject());
          File file = new File(path, fileName);
          lastModified = Math.max(getLastModifiedTime(file), lastModified);
        }
      } else if (entry instanceof Path) {
        Path path = (Path) entry;
        for (String src : path.list()) {
          File file = new File(src);
          lastModified = Math.max(getLastModifiedTime(file), lastModified);
        }
      }
    }

    return lastModified;
  }
174233
public Date getLastModified(String filename)
        throws IOException, ServerException {
        if (filename == null) {
            throw new IllegalArgumentException("Required argument missing");
        }
        Command cmd = new Command("MDTM", filename);
        Reply reply = null;
        try {
            reply = controlChannel.execute(cmd);
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(
                                urce,
                                "Server refused changing transfer mode");
        }

        if (dateFormat == null) {
            dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
            dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
        }

        try {
            return dateFormat.parse(reply.getMessage());
        } catch (ParseException e) {
            throw ServerException.embedFTPReplyParseException(
                     new FTPReplyParseException(
                            0,
                            "Invalid file modification time reply: " + reply));
        }
    }
1193083
public static long getLastModifiedRecursive(File file) {
		long time=file.lastModified();
		if(file.isDirectory()) {
			String[] list=file.list();
			if(list!=null) {
				int len=list.length;
				for(int c=0; c<len; c++) {
					long time2=getLastModifiedRecursive(new File(file, list[c]));
					if (time2 > time) time=time2;
				}
			}
		}
		return time;
	}
284782
public static String extension(String file) {
      if (StringUtils.isNullOrBlank(file)) {
         return StringUtils.EMPTY;
      }
      file = StringUtils.trim(file);
      int index = indexOfFileExtension(file);
      if (index == -1) {
         return StringUtils.EMPTY;
      }
      return file.substring(index + 1);
   }
667220
public static byte[] md5FileToByte(File file) {
        if (file == null) return null;
        FileInputStream   fis               = null;
        DigestInputStream digestInputStream = null;
        try {
            fis = new FileInputStream(file);
            MessageDigest md = MessageDigest.getInstance("MD5");
            digestInputStream = new DigestInputStream(fis, md);
            byte[] buffer = new byte[256 * 1024];
            while (digestInputStream.read(buffer) > 0) ;
            md = digestInputStream.getMessageDigest();
            return md.digest();
        } catch (NoSuchAlgorithmException | IOException e) {
            e.printStackTrace();
            return null;
        } finally {
            IOKit.closeQuietly(fis);
            IOKit.closeQuietly(digestInputStream);
        }
    }
437802
public static synchronized Media get(File file)
    {
        Check.notNull(file);

        final String filename = file.getPath();
        final String localFile = filename.substring(resourcesDir.length() + filename.lastIndexOf(resourcesDir));

        return create(localFile);
    }
1169198
public File getMinifiedFile(File file) {
        File output = getOutputFile(file);
        return new File(output.getParentFile().getAbsoluteFile(),
                output.getName().replace(".js", googleClosureMinifierSuffix + ".js"));
    }
1041037
public static Object pollFile(File file, int timeout, int interval)
            throws InterruptedException {
        // Convert time from s to ms for Thread
        int fullTimeout = Math.round(timeout * 1000);

        // Split up the timeout to poll every x amount of time
        int timeoutShard = Math.round(fullTimeout / interval);

        // Poll until file exists, return if it exists
        for (int i = 0; i < interval; i++) {
            Thread.sleep(timeoutShard);
            if (file.exists()) {
                return readObjectFromFile(file);
            }
        }

        // Return null if time is up and still no file
        return null;
    }
404955
public static BOMInputStream getBOMInputStream(File file) throws IORuntimeException {
		try {
			return new BOMInputStream(new FileInputStream(file));
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
9133
protected UploadFile convertUploadFile(File file) {
        Date lastModifiedDate = new Date();
        // Avoid parsing error on last modified date
        if (file.lastModifiedDate != null && !file.lastModifiedDate.isEmpty()) {
            lastModifiedDate = new Date(file.lastModifiedDate);
        }
        return new UploadFile(file.name, lastModifiedDate, Double.parseDouble(file.size), file.type);
    }
1204888
public static MappedByteBuffer map(File file) {
        N.checkArgNotNull(file);

        return map(file, MapMode.READ_ONLY);
    }
453843
@NotNull
    public static boolean delete(@Nullable File file) {
        if (file == null) {
            LOGGER.warn("cannot delete null File");
            return false;
        }

        final boolean success = org.apache.commons.io.FileUtils.deleteQuietly(file);
        if (!success) {
            LOGGER.debug("Failed to delete file: {}; attempting to delete on exit.", file.getPath());
            file.deleteOnExit();
        }
        return success;
    }
909831
public byte[] getFileBytes(File file) throws IORuntimeException {
		byte[] bytes = cache.get(file);
		if (bytes != null) {
			return bytes;
		}

		// add file
		bytes = FileUtil.readBytes(file);

		if ((maxFileSize != 0) && (file.length() > maxFileSize)) {
			//大于缓存空间，不缓存，直接返回
			return bytes;
		}

		usedSize += bytes.length;

		//文件放入缓存，如果usedSize > capacity，purge()方法将被调用
		cache.put(file, bytes);

		return bytes;
	}
698611
public boolean isExpired(final ProviderIdent ident, final File file) {
        return !file.exists() || !scannedFiles.contains(memoize(file));
    }
638498
public static String getType(File file) throws IORuntimeException {
		FileInputStream in = null;
		try {
			in = IoUtil.toStream(file);
			return getType(in);
		} finally {
			IoUtil.close(in);
		}
	}