Class CharSequenceWrapper
java.lang.Object
org.apache.drill.exec.expr.fn.impl.CharSequenceWrapper
- All Implemented Interfaces:
CharSequence
A CharSequence is a readable sequence of char values. This interface provides
uniform, read-only access to many different kinds of char sequences. A char
value represents a character in the Basic Multilingual Plane (BMP) or a
surrogate. Refer to Unicode Character Representation for details.
Specifically this implementation of the CharSequence adapts a Drill
Specifically this implementation of the CharSequence adapts a Drill
DrillBuf to the CharSequence. The implementation is meant to be
re-used that is allocated once and then passed DrillBuf to adapt. This can be
handy to exploit API that consume CharSequence avoiding the need to create
string objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncharcharAt(int index) intlength()voidSet the DrillBuf to adapt to a CharSequence.subSequence(int start, int end) When using the Java regexMatcherthe subSequence is only called when capturing groups.toString()The regexp_replace function is implemented in a way to avoid the call to toString() not to uselessly create a string object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints
-
Constructor Details
-
CharSequenceWrapper
public CharSequenceWrapper() -
CharSequenceWrapper
-
-
Method Details
-
length
public int length()- Specified by:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAtin interfaceCharSequence
-
subSequence
When using the Java regexMatcherthe subSequence is only called when capturing groups. Drill does not currently use capture groups in the UDF so this method is not required.
It could be implemented by creating a new CharSequenceWrapper however this would imply newly allocated objects which is what this wrapper tries to avoid.- Specified by:
subSequencein interfaceCharSequence
-
setBuffer
Set the DrillBuf to adapt to a CharSequence. This method can be used to replace any previous DrillBuf thus avoiding recreating the CharSequenceWrapper and thus re-using the CharSequenceWrapper object.- Parameters:
start-end-buffer-
-
toString
The regexp_replace function is implemented in a way to avoid the call to toString() not to uselessly create a string object.- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-