Package org.basex.util
Class TokenParser
java.lang.Object
org.basex.util.TokenParser
This class can be used to iterate through all codepoints of a token.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanconsume(int ch) Tries to consume the specified codepoint.final booleanmore()Checks if the parser will return more codepoints.final intnext()Returns the current codepoint and advances the cursor.final voidreset()Resets the cursor position.final int[]toArray()Returns an array with all codepoints.toString()
-
Field Details
-
token
protected final byte[] tokenToken to be parsed.
-
-
Constructor Details
-
TokenParser
public TokenParser(byte[] token) Constructor.- Parameters:
token- token
-
-
Method Details
-
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 ch) Tries to consume the specified codepoint.- Parameters:
ch- codepoint to be consumed- Returns:
- indicates if the codepoint was consumed
-
toArray
public final int[] toArray()Returns an array with all codepoints.- Returns:
- array
-
toString
-