filetools.filesearchtools
Class SimpleFileSearch

java.lang.Object
  extended by filetools.filesearchtools.SimpleFileSearch
All Implemented Interfaces:
IFileSearch
Direct Known Subclasses:
MatlabfunctionFileSearch, MatlabHelpfileIndexer

public abstract class SimpleFileSearch
extends java.lang.Object
implements IFileSearch

Abstract base class for a simple recursive file search. It provides functionality for searching files and storing their names in in a primitive ascii file. In this file each line contains one filename. Derivied classes need to define which (sub-)directories should be searched and which filenames are valid (and to be stored).

Author:
osiris

Field Summary
protected  java.io.FileWriter outputFileWriter
           
 
Constructor Summary
SimpleFileSearch()
           
 
Method Summary
protected abstract  boolean isDirToSearch(java.lang.String dir)
          Derived classes need to define here which directories should be searched.
protected abstract  boolean isSearchedFileName(java.lang.String filename)
          Derived classes need to define here which files are searched.
protected abstract  void processFile(java.io.File file)
          Here concrete classes need to define what to do with a searched file which was found.
 int searchDir(java.io.File searchdir)
          Searches the specified directory for files and stores the result in a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputFileWriter

protected java.io.FileWriter outputFileWriter
Constructor Detail

SimpleFileSearch

public SimpleFileSearch()
Method Detail

searchDir

public int searchDir(java.io.File searchdir)
Description copied from interface: IFileSearch
Searches the specified directory for files and stores the result in a file

Specified by:
searchDir in interface IFileSearch
Parameters:
searchdir - Directory to search
Returns:
Number of valid items found
See Also:
IFileSearch.searchDir(java.io.File)

processFile

protected abstract void processFile(java.io.File file)
Here concrete classes need to define what to do with a searched file which was found.

Parameters:
file - File object which represents the found file

isDirToSearch

protected abstract boolean isDirToSearch(java.lang.String dir)
Derived classes need to define here which directories should be searched.

Parameters:
dir - Name of the directory, not the whole path!
Returns:
true if this directory should be searched

isSearchedFileName

protected abstract boolean isSearchedFileName(java.lang.String filename)
Derived classes need to define here which files are searched.

Parameters:
filename - Name of the file, not its path!
Returns:
true if this is a searched file