Package io.debezium.text
Class TokenStream.CharacterArrayStream
- java.lang.Object
-
- io.debezium.text.TokenStream.CharacterArrayStream
-
- All Implemented Interfaces:
TokenStream.CharacterStream
- Enclosing class:
- TokenStream
public static final class TokenStream.CharacterArrayStream extends Object implements TokenStream.CharacterStream
An implementation ofTokenStream.CharacterStreamthat works with a single character array.
-
-
Field Summary
Fields Modifier and Type Field Description private intcolumnNumberprivate char[]contentprivate intlastIndexprivate intlineNumberprivate intmaxIndexprivate booleannextCharMayBeLineFeed
-
Constructor Summary
Constructors Constructor Description CharacterArrayStream(char[] content)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Determine if there is another character available in this stream.intindex()Get the index for the last character returned fromTokenStream.CharacterStream.next().booleanisNext(char c)Determine if the next character on the sream is the supplied value.booleanisNext(char nextChar1, char nextChar2)Determine if the next two characters on the stream match the supplied values.booleanisNext(char nextChar1, char nextChar2, char nextChar3)Determine if the next three characters on the sream match the supplied values.booleanisNextAnyOf(char[] characters)Determine if the next character on the stream matches one of the supplied characters.booleanisNextAnyOf(String characters)Determine if the next character on the stream matches one of the supplied characters.booleanisNextLetterOrDigit()Determine if the next character on the stream is aletter or digit.booleanisNextValidXmlCharacter()Determine if the next character on the stream is avalid XML character.booleanisNextValidXmlNameCharacter()Determine if the next character on the sream is avalid XML NCName character.booleanisNextValidXmlNcNameCharacter()Determine if the next character on the sream is avalid XML NCName character.booleanisNextWhitespace()Determine if the next character on the stream is awhitespace character.charnext()Obtain the next character value, and advance the stream.Positionposition(int startIndex)Get the position for the last character returned fromTokenStream.CharacterStream.next().Stringsubstring(int startIndex, int endIndex)Get the content from the start position to the end position.
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from interface:TokenStream.CharacterStreamDetermine if there is another character available in this stream.- Specified by:
hasNextin interfaceTokenStream.CharacterStream- Returns:
- true if there is another character (and
TokenStream.CharacterStream.next()can be called), or false otherwise
-
index
public int index()
Description copied from interface:TokenStream.CharacterStreamGet the index for the last character returned fromTokenStream.CharacterStream.next().- Specified by:
indexin interfaceTokenStream.CharacterStream- Returns:
- the index of the last character returned
-
position
public Position position(int startIndex)
Description copied from interface:TokenStream.CharacterStreamGet the position for the last character returned fromTokenStream.CharacterStream.next().- Specified by:
positionin interfaceTokenStream.CharacterStream- Parameters:
startIndex- the starting index- Returns:
- the position of the last character returned; never null
-
substring
public String substring(int startIndex, int endIndex)
Description copied from interface:TokenStream.CharacterStreamGet the content from the start position to the end position.- Specified by:
substringin interfaceTokenStream.CharacterStream- Parameters:
startIndex- the starting indexendIndex- the index after the last character to include- Returns:
- the content
-
next
public char next()
Description copied from interface:TokenStream.CharacterStreamObtain the next character value, and advance the stream.- Specified by:
nextin interfaceTokenStream.CharacterStream- Returns:
- the next character
-
isNext
public boolean isNext(char c)
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the sream is the supplied value. This method does not advance the stream.- Specified by:
isNextin interfaceTokenStream.CharacterStream- Parameters:
c- the character value to compare to the next character on the stream- Returns:
- true if there is a
nextcharacter and it is the supplied character, or false otherwise
-
isNext
public boolean isNext(char nextChar1, char nextChar2)Description copied from interface:TokenStream.CharacterStreamDetermine if the next two characters on the stream match the supplied values. This method does not advance the stream.- Specified by:
isNextin interfaceTokenStream.CharacterStream- Parameters:
nextChar1- the character value to compare to the next character on the streamnextChar2- the character value to compare to the character immediately after the next character on the stream- Returns:
- true if there are at least two characters left on the stream and the first matches
nextCharand the second matchesfollowingChar
-
isNext
public boolean isNext(char nextChar1, char nextChar2, char nextChar3)Description copied from interface:TokenStream.CharacterStreamDetermine if the next three characters on the sream match the supplied values. This method does not advance the stream.- Specified by:
isNextin interfaceTokenStream.CharacterStream- Parameters:
nextChar1- the character value to compare to the next character on the streamnextChar2- the character value to compare to the second character on the streamnextChar3- the character value to compare to the second character on the stream- Returns:
- true if there are at least two characters left on the stream and the first matches
nextCharand the second matchesfollowingChar
-
isNextAnyOf
public boolean isNextAnyOf(char[] characters)
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the stream matches one of the supplied characters. This method does not advance the stream.- Specified by:
isNextAnyOfin interfaceTokenStream.CharacterStream- Parameters:
characters- the characters to match- Returns:
- true if there is a
nextcharacter and it does match one of the supplied characters, or false otherwise
-
isNextAnyOf
public boolean isNextAnyOf(String characters)
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the stream matches one of the supplied characters. This method does not advance the stream.- Specified by:
isNextAnyOfin interfaceTokenStream.CharacterStream- Parameters:
characters- the characters to match- Returns:
- true if there is a
nextcharacter and it does match one of the supplied characters, or false otherwise
-
isNextWhitespace
public boolean isNextWhitespace()
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the stream is awhitespace character. This method does not advance the stream.- Specified by:
isNextWhitespacein interfaceTokenStream.CharacterStream- Returns:
- true if there is a
nextcharacter and it is a whitespace character, or false otherwise
-
isNextLetterOrDigit
public boolean isNextLetterOrDigit()
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the stream is aletter or digit. This method does not advance the stream.- Specified by:
isNextLetterOrDigitin interfaceTokenStream.CharacterStream- Returns:
- true if there is a
nextcharacter and it is a letter or digit, or false otherwise
-
isNextValidXmlCharacter
public boolean isNextValidXmlCharacter()
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the stream is avalid XML character. This method does not advance the stream.- Specified by:
isNextValidXmlCharacterin interfaceTokenStream.CharacterStream- Returns:
- true if there is a
nextcharacter and it is a valid XML character, or false otherwise
-
isNextValidXmlNameCharacter
public boolean isNextValidXmlNameCharacter()
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the sream is avalid XML NCName character. This method does not advance the stream.- Specified by:
isNextValidXmlNameCharacterin interfaceTokenStream.CharacterStream- Returns:
- true if there is a
nextcharacter and it is a valid XML Name character, or false otherwise
-
isNextValidXmlNcNameCharacter
public boolean isNextValidXmlNcNameCharacter()
Description copied from interface:TokenStream.CharacterStreamDetermine if the next character on the sream is avalid XML NCName character. This method does not advance the stream.- Specified by:
isNextValidXmlNcNameCharacterin interfaceTokenStream.CharacterStream- Returns:
- true if there is a
nextcharacter and it is a valid XML NCName character, or false otherwise
-
-