org.pf.file
Interface FileHandler

All Known Implementing Classes:
FileFinder

public interface FileHandler

This interface must be implemented by classes, that want to use the generic services of FileWalker.
It defines callback methods, that are invoked by a FileWalker instance, when it is 'walking' through a directory(-tree).

Version:
1.0
Author:
Manfred Duchrow
See Also:
FileWalker

Method Summary
 boolean directoryEnd(File dir)
          This method is called for each directory, that a FileWalker finished to walk through.
 boolean directoryStart(File dir, int count)
          This method is called for each directory, that a FileWalker starts to walk through.
 boolean handleException(Exception ex, File file)
          This method is called for whenever an exception occurs in walking through the directories.
 boolean handleFile(File file)
          This method is called for each file, that a FileWalker instance finds.
 

Method Detail

handleFile

boolean handleFile(File file)
This method is called for each file, that a FileWalker instance finds. It must return true, if the FileWalker should continue. To stop the calling FileWalker it can return false.

Parameters:
The - file, currently found by the FileWalker instance
Returns:
true to continue, false to terminate processing of files

handleException

boolean handleException(Exception ex,
                        File file)
This method is called for whenever an exception occurs in walking through the directories.
The method must return true, if the FileWalker should continue. To stop the calling FileWalker it can return false.

Parameters:
ex - The exception to handle
The - file, currently found by the FileWalker instance
Returns:
true to continue, false to terminate processing of files

directoryEnd

boolean directoryEnd(File dir)
This method is called for each directory, that a FileWalker finished to walk through. It must return true, if the FileWalker should continue. To stop the calling FileWalker it can return false.

Parameters:
dir - The directory, the FileWalker has finished to walk through
Returns:
true to continue, false to terminate processing of files

directoryStart

boolean directoryStart(File dir,
                       int count)
This method is called for each directory, that a FileWalker starts to walk through. It must return true, if the FileWalker should continue. To stop the calling FileWalker it can return false.

Parameters:
dir - The directory, the FileWalker is starting to walk through
count - The number of files and directories the FileWalker found in the directory
Returns:
true to continue, false to terminate processing of files