Java Code Examples for org.apache.commons.io.FileUtils#isFileNewer()

The following examples show how to use org.apache.commons.io.FileUtils#isFileNewer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompilationScope.java    From cuba with Apache License 2.0 6 votes vote down vote up
private void collectInformation(String rootClassName) throws ClassNotFoundException {
    if (processed.contains(rootClassName)) {
        return;
    }

    File srcFile = sourceProvider.getSourceFile(rootClassName);
    processed.add(rootClassName);

    TimestampClass timeStampClazz = javaClassLoader.getTimestampClass(rootClassName);
    if (timeStampClazz != null) {
        if (FileUtils.isFileNewer(srcFile, timeStampClazz.timestamp)) {
            compilationNeeded.add(rootClassName);
        } else if (!srcFile.exists()) {
            throw new ClassNotFoundException(
                    String.format("Class %s not found. No sources found in file system.", rootClassName));
        }

        for (String dependencyName : timeStampClazz.dependencies) {
            collectInformation(dependencyName);
        }
    } else {
        compilationNeeded.add(rootClassName);
    }
}
 
Example 2
Source File: AgeFileFilter.java    From aion-germany with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Checks to see if the last modification of the file matches cutoff
 * favorably.
 * <p>
 * If last modification time equals cutoff and newer files are required,
 * file <b>IS NOT</b> selected.
 * If last modification time equals cutoff and older files are required,
 * file <b>IS</b> selected.
 *
 * @param file  the File to check
 * @return true if the filename matches
 */
@Override
public boolean accept(File file) {
    boolean newer = FileUtils.isFileNewer(file, cutoff);
    return acceptOlder ? !newer : newer;
}
 
Example 3
Source File: AgeFileFilter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Checks to see if the last modification of the file matches cutoff
 * favorably.
 * <p>
 * If last modification time equals cutoff and newer files are required,
 * file <b>IS NOT</b> selected.
 * If last modification time equals cutoff and older files are required,
 * file <b>IS</b> selected.
 *
 * @param file  the File to check
 * @return true if the filename matches
 */
@Override
public boolean accept(final File file) {
    final boolean newer = FileUtils.isFileNewer(file, cutoff);
    return acceptOlder ? !newer : newer;
}