NIO2 API

org.classpath.icedtea.java.nio.file
Interface FileAction<T extends FileRef>

Type Parameters:
T - The type of file reference

public interface FileAction<T extends FileRef>

An interface that is implemented by objects that operate on a file. An implementation of this interface is provided to the withDirectory utility method so that the file action is invoked for all accepted entries in the directory, after which, the directory is automatically closed.

Usage Example: Suppose we require to perform a task on all class files in a directory:

     Path dir = ...
     Files.withDirectory(dir, "*.class", new FileAction<Path>() {
         public void invoke(Path entry) {
             :
         }
     });
 

Since:
1.7

Method Summary
 void invoke(T file)
          Invoked for a file.
 

Method Detail

invoke

void invoke(T file)
            throws IOException
Invoked for a file.

Parameters:
file - The file
Throws:
IOException - If the block terminates due an uncaught I/O exception

NIO2 API

Copyright © 2007, 2011, Oracle and/or its affiliates. All rights reserved.