Class AbstractStringMatcher.CharArrayMatcher

    • Field Detail

      • chars

        private final char[] chars
        The string to match, as a character array, implementation treats as immutable.
      • string

        private final java.lang.String string
        The string to match.
    • Constructor Detail

      • CharArrayMatcher

        CharArrayMatcher​(char... chars)
        Constructs a matcher from a String.
        Parameters:
        chars - the string to match, must not be null
    • Method Detail

      • isMatch

        public int isMatch​(char[] buffer,
                           int start,
                           int bufferStart,
                           int bufferEnd)
        Returns the number of matching characters, 0 if there is no match.
        Parameters:
        buffer - the text content to match against, do not change
        start - the starting position for the match, valid for buffer
        bufferStart - unused
        bufferEnd - the end index of the active buffer, valid for buffer
        Returns:
        The number of matching characters, zero for no match
      • isMatch

        public int isMatch​(java.lang.CharSequence buffer,
                           int start,
                           int bufferStart,
                           int bufferEnd)
        Returns the number of matching characters, 0 if there is no match.
        Parameters:
        buffer - the text content to match against, do not change
        start - the starting position for the match, valid for buffer
        bufferStart - unused
        bufferEnd - the end index of the active buffer, valid for buffer
        Returns:
        The number of matching characters, zero for no match
      • size

        public int size()
        Returns the size of the string to match given in the constructor.
        Returns:
        the size of the matching string.
        Since:
        1.9
      • toString

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