edu.stanford.nlp.util
Class FilePathProcessor

java.lang.Object
  extended by edu.stanford.nlp.util.FilePathProcessor

public class FilePathProcessor
extends java.lang.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.

Note: This is used in our old code in ling/trees, but newer code should probably use io.FileSequentialCollection

Author:
Christopher Manning

Method Summary
static void processPath(java.io.File path, java.io.FileFilter filter, FileProcessor processor)
          Apply a function to the files under a given directory and perhaps its subdirectories.
static void processPath(java.io.File path, java.lang.String suffix, boolean recursively, FileProcessor processor)
          Apply a method to the files under a given directory and perhaps its subdirectories.
static void processPath(java.lang.String pathStr, java.lang.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
 

Method Detail

processPath

public static void processPath(java.lang.String pathStr,
                               java.lang.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(java.io.File path,
                               java.lang.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(java.io.File path,
                               java.io.FileFilter filter,
                               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
filter - a FileFilter of files to load. The filter may be null, and then all files are processed.
processor - The FileProcessor to apply to each File


Stanford NLP Group