Example usage for org.apache.commons.io.monitor FileEntry refresh

List of usage examples for org.apache.commons.io.monitor FileEntry refresh

Introduction

In this page you can find the example usage for org.apache.commons.io.monitor FileEntry refresh.

Prototype

public boolean refresh(File file) 

Source Link

Document

Refresh the attributes from the File , indicating whether the file has changed.

Usage

From source file:com.owncloud.android.services.observer.AdvancedFileAlterationObserver.java

/**
 * Create a new file entry for the specified file.
 *
 * @param parent The parent file entry/*from  w  ww.ja v  a 2 s.c o  m*/
 * @param file   The file to create an entry for
 * @return A new file entry
 */
private FileEntry createFileEntry(final FileEntry parent, final File file) {
    final FileEntry entry = parent.newChildInstance(file);
    entry.refresh(file);
    final FileEntry[] children = doListFiles(file, entry);
    entry.setChildren(children);
    return entry;
}

From source file:com.owncloud.android.services.observer.AdvancedFileAlterationObserver.java

/**
 * Fire directory/file change events to the registered listeners.
 *
 * @param entry The previous file system entry
 * @param file  The current file/*from w  w  w  . j  ava2  s.c  om*/
 */
private void doMatch(final FileEntry entry, final File file, int delay) {
    if (entry.refresh(file)) {
        for (final AdvancedFileAlterationListener listener : listeners) {
            if (entry.isDirectory()) {
                listener.onDirectoryChange(file);
            } else {
                listener.onFileChange(file, delay);
            }
        }
    }
}

From source file:org.opoo.press.file.WatchableFiles.java

@Override
public void initialize() {
    for (FileEntry entry : entries) {
        entry.refresh(entry.getFile());
    }
}

From source file:org.opoo.press.file.WatchableFiles.java

@Override
public Result check() {
    Result result = Result.newResult();
    for (FileEntry entry : entries) {
        if (entry.refresh(entry.getFile())) {
            //check update only
            result.addUpdatedFile(entry.getFile());
        }//from   ww  w  .ja  v a  2s .c o m
    }
    return result;
}