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 of TokenStream.CharacterStream that works with a single character array.
  • Field Details

    • content

      private final char[] content
    • lastIndex

      private int lastIndex
    • maxIndex

      private final int maxIndex
    • lineNumber

      private int lineNumber
    • columnNumber

      private int columnNumber
    • nextCharMayBeLineFeed

      private boolean nextCharMayBeLineFeed
  • Constructor Details

    • CharacterArrayStream

      public CharacterArrayStream(char[] content)
  • Method Details

    • hasNext

      public boolean hasNext()
      Description copied from interface: TokenStream.CharacterStream
      Determine if there is another character available in this stream.
      Specified by:
      hasNext in interface TokenStream.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.CharacterStream
      Get the index for the last character returned from TokenStream.CharacterStream.next().
      Specified by:
      index in interface TokenStream.CharacterStream
      Returns:
      the index of the last character returned
    • position

      public Position position(int startIndex)
      Description copied from interface: TokenStream.CharacterStream
      Get the position for the last character returned from TokenStream.CharacterStream.next().
      Specified by:
      position in interface TokenStream.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.CharacterStream
      Get the content from the start position to the end position.
      Specified by:
      substring in interface TokenStream.CharacterStream
      Parameters:
      startIndex - the starting index
      endIndex - the index after the last character to include
      Returns:
      the content
    • next

      public char next()
      Description copied from interface: TokenStream.CharacterStream
      Obtain the next character value, and advance the stream.
      Specified by:
      next in interface TokenStream.CharacterStream
      Returns:
      the next character
    • isNext

      public boolean isNext(char c)
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the sream is the supplied value. This method does not advance the stream.
      Specified by:
      isNext in interface TokenStream.CharacterStream
      Parameters:
      c - the character value to compare to the next character on the stream
      Returns:
      true if there is a next character and it is the supplied character, or false otherwise
    • isNext

      public boolean isNext(char nextChar1, char nextChar2)
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next two characters on the stream match the supplied values. This method does not advance the stream.
      Specified by:
      isNext in interface TokenStream.CharacterStream
      Parameters:
      nextChar1 - the character value to compare to the next character on the stream
      nextChar2 - 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 nextChar and the second matches followingChar
    • isNext

      public boolean isNext(char nextChar1, char nextChar2, char nextChar3)
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next three characters on the sream match the supplied values. This method does not advance the stream.
      Specified by:
      isNext in interface TokenStream.CharacterStream
      Parameters:
      nextChar1 - the character value to compare to the next character on the stream
      nextChar2 - the character value to compare to the second character on the stream
      nextChar3 - 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 nextChar and the second matches followingChar
    • isNextAnyOf

      public boolean isNextAnyOf(char[] characters)
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the stream matches one of the supplied characters. This method does not advance the stream.
      Specified by:
      isNextAnyOf in interface TokenStream.CharacterStream
      Parameters:
      characters - the characters to match
      Returns:
      true if there is a next character and it does match one of the supplied characters, or false otherwise
    • isNextAnyOf

      public boolean isNextAnyOf(String characters)
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the stream matches one of the supplied characters. This method does not advance the stream.
      Specified by:
      isNextAnyOf in interface TokenStream.CharacterStream
      Parameters:
      characters - the characters to match
      Returns:
      true if there is a next character and it does match one of the supplied characters, or false otherwise
    • isNextWhitespace

      public boolean isNextWhitespace()
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the stream is a whitespace character. This method does not advance the stream.
      Specified by:
      isNextWhitespace in interface TokenStream.CharacterStream
      Returns:
      true if there is a next character and it is a whitespace character, or false otherwise
    • isNextLetterOrDigit

      public boolean isNextLetterOrDigit()
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the stream is a letter or digit. This method does not advance the stream.
      Specified by:
      isNextLetterOrDigit in interface TokenStream.CharacterStream
      Returns:
      true if there is a next character and it is a letter or digit, or false otherwise
    • isNextValidXmlCharacter

      public boolean isNextValidXmlCharacter()
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the stream is a valid XML character. This method does not advance the stream.
      Specified by:
      isNextValidXmlCharacter in interface TokenStream.CharacterStream
      Returns:
      true if there is a next character and it is a valid XML character, or false otherwise
    • isNextValidXmlNameCharacter

      public boolean isNextValidXmlNameCharacter()
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the sream is a valid XML NCName character. This method does not advance the stream.
      Specified by:
      isNextValidXmlNameCharacter in interface TokenStream.CharacterStream
      Returns:
      true if there is a next character and it is a valid XML Name character, or false otherwise
    • isNextValidXmlNcNameCharacter

      public boolean isNextValidXmlNcNameCharacter()
      Description copied from interface: TokenStream.CharacterStream
      Determine if the next character on the sream is a valid XML NCName character. This method does not advance the stream.
      Specified by:
      isNextValidXmlNcNameCharacter in interface TokenStream.CharacterStream
      Returns:
      true if there is a next character and it is a valid XML NCName character, or false otherwise