Package org.apache.hadoop.hbase.filter
Class RegexStringComparator.JoniRegexEngine
java.lang.Object
org.apache.hadoop.hbase.filter.RegexStringComparator.JoniRegexEngine
- All Implemented Interfaces:
RegexStringComparator.Engine
- Enclosing class:
- RegexStringComparator
static class RegexStringComparator.JoniRegexEngine
extends Object
implements RegexStringComparator.Engine
Implementation of the Engine interface using Jruby's joni regex engine.
This engine operates on byte arrays directly so is expected to be more GC friendly, and reportedly is twice as fast as Java's Pattern engine.
NOTE: Only the Pattern
flags CASE_INSENSITIVE, DOTALL, and MULTILINE are supported.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(byte[] value, int offset, int length) Match the given input against the configured patternReturns the name of the configured charsetint
getFlags()
Returns the set of configured match flags, a bit mask that may includePattern
flagsReturns the string representation of the configured regular expression for matchingprivate int
joniToPatternFlags
(int flags) private int
patternToJoniFlags
(int flags) void
setCharset
(String name) Set the charset used when matchingprivate void
setEncoding
(String name) byte[]
Return the serialized form of the configured matcher
-
Field Details
-
encoding
-
regex
-
pattern
-
-
Constructor Details
-
JoniRegexEngine
-
-
Method Details
-
getPattern
Description copied from interface:RegexStringComparator.Engine
Returns the string representation of the configured regular expression for matching- Specified by:
getPattern
in interfaceRegexStringComparator.Engine
-
getFlags
Description copied from interface:RegexStringComparator.Engine
Returns the set of configured match flags, a bit mask that may includePattern
flags- Specified by:
getFlags
in interfaceRegexStringComparator.Engine
-
getCharset
Description copied from interface:RegexStringComparator.Engine
Returns the name of the configured charset- Specified by:
getCharset
in interfaceRegexStringComparator.Engine
-
setCharset
Description copied from interface:RegexStringComparator.Engine
Set the charset used when matching- Specified by:
setCharset
in interfaceRegexStringComparator.Engine
- Parameters:
name
- the name of the desired charset for matching
-
compareTo
Description copied from interface:RegexStringComparator.Engine
Match the given input against the configured pattern- Specified by:
compareTo
in interfaceRegexStringComparator.Engine
- Parameters:
value
- the data to be matchedoffset
- offset of the data to be matchedlength
- length of the data to be matched- Returns:
- 0 if a match was made, 1 otherwise
-
toByteArray
Description copied from interface:RegexStringComparator.Engine
Return the serialized form of the configured matcher- Specified by:
toByteArray
in interfaceRegexStringComparator.Engine
-
patternToJoniFlags
-
joniToPatternFlags
-
setEncoding
-