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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(byte[] value, int offset, int length) Match the given input against the configured patternReturns the name of the configured charsetintgetFlags()Returns the set of configured match flags, a bit mask that may includePatternflagsReturns the string representation of the configured regular expression for matchingprivate intjoniToPatternFlags(int flags) private intpatternToJoniFlags(int flags) voidsetCharset(String name) Set the charset used when matchingprivate voidsetEncoding(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.EngineReturns the string representation of the configured regular expression for matching- Specified by:
getPatternin interfaceRegexStringComparator.Engine
-
getFlags
Description copied from interface:RegexStringComparator.EngineReturns the set of configured match flags, a bit mask that may includePatternflags- Specified by:
getFlagsin interfaceRegexStringComparator.Engine
-
getCharset
Description copied from interface:RegexStringComparator.EngineReturns the name of the configured charset- Specified by:
getCharsetin interfaceRegexStringComparator.Engine
-
setCharset
Description copied from interface:RegexStringComparator.EngineSet the charset used when matching- Specified by:
setCharsetin interfaceRegexStringComparator.Engine- Parameters:
name- the name of the desired charset for matching
-
compareTo
Description copied from interface:RegexStringComparator.EngineMatch the given input against the configured pattern- Specified by:
compareToin 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.EngineReturn the serialized form of the configured matcher- Specified by:
toByteArrayin interfaceRegexStringComparator.Engine
-
patternToJoniFlags
-
joniToPatternFlags
-
setEncoding
-