Class StrMatcher.StringMatcher

  • Enclosing class:
    StrMatcher

    static final class StrMatcher.StringMatcher
    extends StrMatcher
    Class used to define a set of characters for matching purposes.
    • Field Detail

      • chars

        private final char[] chars
        The string to match, as a character array.
    • Constructor Detail

      • StringMatcher

        StringMatcher​(java.lang.String str)
        Constructor that creates a matcher from a String.
        Parameters:
        str - the string to match, must not be null
    • Method Detail

      • isMatch

        public int isMatch​(char[] buffer,
                           int pos,
                           int bufferStart,
                           int bufferEnd)
        Returns whether or not the given text matches the stored string.
        Specified by:
        isMatch in class StrMatcher
        Parameters:
        buffer - the text content to match against, do not change
        pos - the starting position for the match, valid for buffer
        bufferStart - the first active index in the buffer, valid for buffer
        bufferEnd - the end index of the active buffer, valid for buffer
        Returns:
        the number of matching characters, zero for no match
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object