|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.text.pattern.PatternUtil
public final class PatternUtil
Pattern-related utility methods.
| Nested Class Summary | |
|---|---|
static interface |
PatternUtil.Replacer
Decides whether and how a match is to be replaced. |
| Method Summary | |
|---|---|
static PatternUtil.Replacer |
constantReplacer(java.lang.String context,
java.lang.String replacement)
|
static int |
replaceAll(java.lang.String context,
java.io.Reader in,
java.util.regex.Pattern pattern,
PatternUtil.Replacer replacer,
java.io.Writer out,
int initialBufferCapacity)
Reads text from in, finds all occurrences of pattern, replaces each with the result of PatternUtil.Replacer.getReplacement(String, CharSequence), and writes the result to out. |
static void |
replaceAll(java.lang.String context,
java.io.Reader in,
java.util.regex.Pattern pattern,
java.lang.String replacement,
java.io.Writer out)
Reads text from in, replaces all occurrences of pattern with replacement, and
writes the result to out. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void replaceAll(java.lang.String context,
java.io.Reader in,
java.util.regex.Pattern pattern,
java.lang.String replacement,
java.io.Writer out)
throws java.io.IOException
in, replaces all occurrences of pattern with replacement, and
writes the result to out.
The pattern search is stream-oriented not line-oriented, i.e. matches are found even across line boundaries.
Thus the pattern should have been compiled with the Pattern.MULTILINE flag.
context - Only for logging; e.g. the name of the file being transformed
java.io.IOException
public static PatternUtil.Replacer constantReplacer(java.lang.String context,
java.lang.String replacement)
PatternUtil.Replacer which constantly produces the given replacement
public static int replaceAll(java.lang.String context,
java.io.Reader in,
java.util.regex.Pattern pattern,
PatternUtil.Replacer replacer,
java.io.Writer out,
int initialBufferCapacity)
throws java.io.IOException
in, finds all occurrences of pattern, replaces each with the result of PatternUtil.Replacer.getReplacement(String, CharSequence), and writes the result to out.
The pattern search is stream-oriented, not line-oriented, i.e. matches are found even across line boundaries.
Thus the pattern should have been compiled with the Pattern.MULTILINE flag.
context - Only for logging; e.g. the name of the file being transformed
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||