org.archive.util
Class PatternMatcherRecycler
java.lang.Object
org.archive.util.PatternMatcherRecycler
public class PatternMatcherRecycler
- extends java.lang.Object
Utility class to retain a compiled Pattern and multiple corresponding
Matcher instances for reuse.
- Author:
- gojomo
Method Summary |
void |
freeMatcher(java.util.regex.Matcher m)
Return the given Matcher to the reuse stack, if stack is
not already at its maximum size. |
java.util.regex.Matcher |
getMatcher(java.lang.CharSequence input)
Get a Matcher for the internal Pattern, against the given
input sequence. |
java.util.regex.Pattern |
getPattern()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PatternMatcherRecycler
public PatternMatcherRecycler(java.util.regex.Pattern p)
getPattern
public java.util.regex.Pattern getPattern()
getMatcher
public java.util.regex.Matcher getMatcher(java.lang.CharSequence input)
- Get a Matcher for the internal Pattern, against the given
input sequence. Reuse an old Matcher if possible, otherwise
create a new one.
- Parameters:
input
- CharSequence to match
- Returns:
- Matcher set against the the input sequence
freeMatcher
public void freeMatcher(java.util.regex.Matcher m)
- Return the given Matcher to the reuse stack, if stack is
not already at its maximum size.
- Parameters:
m
- the Matcher to save for reuse
Copyright © 2003-2011 Internet Archive. All Rights Reserved.