| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.jutil.java.regex.RegexReplacer
A class of object the replace regular expressions for others.
 
 For example, it can replace a regular expression in a file and write the output to another file.
At this moment, we use JRegex instead of jdk 1.4 regular expressions because:
This means that this class will change in the future, and the 
 Pattern class will probably disappear since it's 
 only adapts the JRegex Pattern class to the interface of java.util.regex.Pattern
 in order to simplify porting afterwards.
| Constructor Summary | |
| RegexReplacer(java.lang.String pattern,
              java.lang.String replacement)Initialize a new RegexReplacer for the given pattern and replacement. | |
| RegexReplacer(java.lang.String pattern,
              java.lang.String replacement,
              int flags)Initialize a new RegexReplacer for the given pattern, replacement and flags. | |
| Method Summary | |
|  Pattern | getPattern()Return the pattern of this RegexReplacer. | 
|  java.lang.String | getReplacement()Return the replacement string of this RegexReplacer. | 
| static void | main(java.lang.String[] args) | 
|  void | replace(java.io.File input,
        java.io.File output)Replace all occurrences of the pattern of this RegexReplacer in the input file by the replacement of this RegexReplacer, and write the result to the output file. Both File objects may refer to the same real file. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public RegexReplacer(java.lang.String pattern,
                     java.lang.String replacement)
pattern - a String containing the pattern to be replaced.replacement - a String containing the pattern to replace the matched pattern.
public RegexReplacer(java.lang.String pattern,
                     java.lang.String replacement,
                     int flags)
pattern - A String containing the pattern to be replaced.replacement - A String containing the pattern to replace the matched pattern.flags - The flags for the pattern.| Method Detail | 
public void replace(java.io.File input,
                    java.io.File output)
             throws java.io.FileNotFoundException,
                    java.io.IOException
Replace all occurrences of the pattern of this RegexReplacer in the input file by the replacement of this RegexReplacer, and write the result to the output file.
Both File objects may refer to the same real file.
input - The file in which the pattern must be replaced.output - The file to which the result must be written.public Pattern getPattern()
public java.lang.String getReplacement()
public static void main(java.lang.String[] args)
                 throws java.lang.Exception
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||