Package org.apache.uima.internal.util
Class ReplaceStringInFiles
java.lang.Object
org.apache.uima.internal.util.ReplaceStringInFiles
String replacement utility.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classResult class for string replacement.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic intindexOfCaseSensitive(String mainStr, String argStr, int start, boolean caseSensitive) static voidReplace a certain string with other strings in files.static final voidreplaceStringInFiles(File dir, FileFilter fileFilter, String toReplace, String replacement, boolean caseSensitive) Replace a string in all files of a directory, recursively.static final voidreplaceStringInString(String text, String toReplace, String replacement, ReplaceStringInFiles.ReplacementResult res, boolean caseSensitive) Replace occurrences oftoReplaceintextbyreplacement.
- 
Constructor Details- 
ReplaceStringInFilespublic ReplaceStringInFiles()
 
- 
- 
Method Details- 
indexOfCaseSensitivepublic static int indexOfCaseSensitive(String mainStr, String argStr, int start, boolean caseSensitive) - Parameters:
- mainStr- The given string object.
- argStr- The given string argument.
- start- -
- caseSensitive- -
- Returns:
- If the given string argument occurs as a substring, ignoring case, within the given
         string object, then the index of the first character of the first such substring is
         returned; if it does not occur as a substring, -1is returned.
 
- 
replaceStringInStringpublic static final void replaceStringInString(String text, String toReplace, String replacement, ReplaceStringInFiles.ReplacementResult res, boolean caseSensitive) Replace occurrences oftoReplaceintextbyreplacement.- Parameters:
- text- The text where the replacement should happen.
- toReplace- The string that should be replaced.
- replacement- The string it should be replaced with.
- res- The result object, containing the result string and the number of times replacement happened.
- caseSensitive- -
 
- 
replaceStringInFilespublic static final void replaceStringInFiles(File dir, FileFilter fileFilter, String toReplace, String replacement, boolean caseSensitive) throws IOException Replace a string in all files of a directory, recursively.- Parameters:
- dir- The directory where replacement should happen.
- fileFilter- A file filter for which files replacement should happen.
- toReplace- String which should be replaced.
- replacement- String it should be replaced with.
- caseSensitive- -
- Throws:
- IOException- Whenever anything goes wrong reading or writing a file.
 
- 
mainReplace a certain string with other strings in files. Example usage:
 java org.apache.uima.util.ReplaceStringInFile /home/tom/stuff .prop $ROOT$ /home/tom/root- Parameters:
- args- dir, extension toreplace replacement [-ignorecase]
 
 
-