ie.tomallen.utils
Class ReplaceStrings

java.lang.Object
  |
  +--ie.tomallen.utils.ReplaceStrings

public class ReplaceStrings
extends java.lang.Object

Implements a replaceString object, for binary and ASCII files. This class will take a file and replace will all occurances of "start" vector given with the equivalant element of the "end" vector

Dependencies: DirectoryHandler, Diff, java.io.File, java.lang.Vector

Version:
0.1
Author:
Tom Allen. © 2003

Constructor Summary
ReplaceStrings(java.util.Vector strStart, java.util.Vector strEnd)
          Constructor, Sets main variables for ReplaceString Class.
ReplaceStrings(java.util.Vector strStart, java.util.Vector strEnd, java.lang.String filter, boolean nested)
          Constructor, Sets all variables for ReplaceString Class
 
Method Summary
 void changeDirectory(java.lang.String filename)
          changeDirectory.
 boolean replaceFile(java.io.File fp)
          replaceFile.
 void setOutputFile(java.lang.String filename)
          setOutputFile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplaceStrings

public ReplaceStrings(java.util.Vector strStart,
                      java.util.Vector strEnd,
                      java.lang.String filter,
                      boolean nested)
Constructor, Sets all variables for ReplaceString Class

Parameters:
filter - String, filename filer string. (from end of filename) e.g. '.html'
nested - Boolean, search all subdirectories.
strStart - Vector of Strings to replace.
strEnd - Vector of Strings with which to replace.

ReplaceStrings

public ReplaceStrings(java.util.Vector strStart,
                      java.util.Vector strEnd)
Constructor, Sets main variables for ReplaceString Class. filter defaulted to null, directory nest defaulted to true.

Parameters:
strStart - Vector of Strings to replace.
strEnd - Vector of Strings with which to replace.
Method Detail

setOutputFile

public void setOutputFile(java.lang.String filename)
setOutputFile. Will run replaceString on every file in given directory. subdirectory will changed also

Parameters:
filename - String.
Throws:
TException

changeDirectory

public void changeDirectory(java.lang.String filename)
                     throws TException
changeDirectory. Will run replaceString on every file in given directory. subdirectory will changed also

Returns:
boolean
Throws:
TException

replaceFile

public boolean replaceFile(java.io.File fp)
                    throws TException
replaceFile. Will run replaceString on every file in given directory. subdirectory will changed also

Parameters:
fp - File
Returns:
boolean
Throws:
TException