edu.stanford.nlp.util
Class FilePathProcessor

java.lang.Object
  |
  +--edu.stanford.nlp.util.FilePathProcessor

public class FilePathProcessor
extends Object

The FilePathProcessor traverses a directory structure and applies the processFile method to files meeting some criterion. It is implemented as static methods, not as an extension of File.


Constructor Summary
FilePathProcessor()
           
 
Method Summary
static void processPath(File path, FileFilter filt, FileProcessor processor)
          Apply a function to the files under a given directory and perhaps its subdirectories.
static void processPath(File path, String suffix, boolean recursively, FileProcessor processor)
          Apply a method to the files under a given directory and perhaps its subdirectories.
static void processPath(String pathStr, String suffix, boolean recursively, FileProcessor processor)
          Apply a method to the files under a given directory and perhaps its subdirectories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePathProcessor

public FilePathProcessor()
Method Detail

processPath

public static void processPath(String pathStr,
                               String suffix,
                               boolean recursively,
                               FileProcessor processor)
Apply a method to the files under a given directory and perhaps its subdirectories.

Parameters:
pathStr - file or directory to load from as a String
suffix - suffix (normally "File extension") of files to load
recursively - true means descend into subdirectories as well
processor - The FileProcessor to apply to each File

processPath

public static void processPath(File path,
                               String suffix,
                               boolean recursively,
                               FileProcessor processor)
Apply a method to the files under a given directory and perhaps its subdirectories.

Parameters:
path - file or directory to load from
suffix - suffix (normally "File extension") of files to load
recursively - true means descend into subdirectories as well
processor - The FileProcessor to apply to each File

processPath

public static void processPath(File path,
                               FileFilter filt,
                               FileProcessor processor)
Apply a function to the files under a given directory and perhaps its subdirectories. If the path is a directory then only files within the directory (perhaps recursively) that satisfy the filter are processed. If the pathis a file, then that file is processed regardless of whether it satisfies the filter. (This semantics was adopted, since otherwise there was no easy way to go through all the files in a directory without descending recursively via the specification of a FileFilter.)

Parameters:
path - file or directory to load from
processor - The FileProcessor to apply to each File


Stanford NLP Group