Package io.debezium.text
Interface TokenStream.Token
- All Known Implementing Classes:
TokenStream.CaseInsensitiveToken
,TokenStream.CaseSensitiveToken
- Enclosing class:
- TokenStream
The interface defining a token, which references the characters in the actual input character stream.
-
Method Summary
Modifier and TypeMethodDescriptionint
endIndex()
Get the index in the raw stream past the last character in the token.int
length()
Get the length of the token, which is equivalent toendIndex() - startIndex()
.boolean
matches
(char expected) Determine if the token matches the supplied character.boolean
matches
(int expectedType) Determine if the token matches the supplied type.default boolean
Determine if the token matches the supplied string and is of a requested type.boolean
Determine if the token matches the supplied string.position()
Get the position of this token, which includes the line number and column number of the first character in the token.int
Get the index in the raw stream for the first character in the token.int
type()
Get the type of the token.value()
Get the value of the token, in actual case.withType
(int typeMask) Bitmask ORed with existing type value.
-
Method Details
-
value
String value()Get the value of the token, in actual case.- Returns:
- the value
-
matches
Determine if the token matches the supplied string.- Parameters:
expected
- the expected value- Returns:
- true if the token's value matches the supplied value, or false otherwise
-
matches
Determine if the token matches the supplied string and is of a requested type.- Parameters:
expectedType
- the expected token typeexpected
- the expected value- Returns:
- true if the token's type and value matches the supplied type and value, or false otherwise
-
matches
boolean matches(char expected) Determine if the token matches the supplied character.- Parameters:
expected
- the expected character value- Returns:
- true if the token's value matches the supplied character value, or false otherwise
-
matches
boolean matches(int expectedType) Determine if the token matches the supplied type.- Parameters:
expectedType
- the expected integer type- Returns:
- true if the token's value matches the supplied integer type, or false otherwise
-
type
int type()Get the type of the token.- Returns:
- the token's type
-
startIndex
int startIndex()Get the index in the raw stream for the first character in the token.- Returns:
- the starting index of the token
-
endIndex
int endIndex()Get the index in the raw stream past the last character in the token.- Returns:
- the ending index of the token, which is past the last character
-
length
int length()Get the length of the token, which is equivalent toendIndex() - startIndex()
.- Returns:
- the length
-
position
Position position()Get the position of this token, which includes the line number and column number of the first character in the token.- Returns:
- the position; never null
-
withType
Bitmask ORed with existing type value.- Parameters:
typeMask
- the mask of types- Returns:
- copy of Token with new type
-