Class TokenParser


  • public class TokenParser
    extends Object

    This class can be used to iterate through all codepoints of a token.

    Author:
    BaseX Team 2005-23, BSD License, Christian Gruen
    • Field Detail

      • token

        protected final byte[] token
        Token to be parsed.
    • Constructor Detail

      • TokenParser

        public TokenParser​(byte[] token)
        Constructor.
        Parameters:
        token - token
    • Method Detail

      • reset

        public final void reset()
        Resets the cursor position.
      • more

        public final boolean more()
        Checks if the parser will return more codepoints.
        Returns:
        result of check
      • next

        public final int next()
        Returns the current codepoint and advances the cursor.
        Returns:
        current codepoint, or -1
      • consume

        public final boolean consume​(int cp)
        Tries to consume the specified codepoint.
        Parameters:
        cp - codepoint to be consumed
        Returns:
        indicates if the codepoint was consumed
      • toArray

        public final int[] toArray()
        Returns an array with all codepoints.
        Returns:
        array