public boolean refresh()

in src/main/java/org/apache/commons/io/monitor/FileEntry.java [215:236]


    public boolean refresh(final File file) {
        // cache original values
        final boolean origExists = exists;
        final SerializableFileTime origLastModified = lastModified;
        final boolean origDirectory = directory;
        final long origLength = length;

        // refresh the values
        name = file.getName();
        exists = Files.exists(file.toPath());
        directory = exists && file.isDirectory();
        try {
            setLastModified(exists ? FileUtils.lastModifiedFileTime(file) : FileTimes.EPOCH);
        } catch (final IOException e) {
            setLastModified(SerializableFileTime.EPOCH);
        }
        length = exists && !directory ? file.length() : 0;

        // Return if there are changes
        return exists != origExists || !lastModified.equals(origLastModified) || directory != origDirectory
            || length != origLength;
    }