Package org.snakeyaml.engine.v2.scanner
Interface Scanner
-
- All Superinterfaces:
Iterator<org.snakeyaml.engine.v2.tokens.Token>
- All Known Implementing Classes:
ScannerImpl
public interface Scanner extends Iterator<org.snakeyaml.engine.v2.tokens.Token>
This interface represents an input stream ofTokens.The scanner and the parser form together the 'Parse' step in the loading process.
- See Also:
- 3.1. Processes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancheckToken(org.snakeyaml.engine.v2.tokens.Token.ID... choices)Check if the next token is one of the given types.org.snakeyaml.engine.v2.tokens.Tokennext()Returns the next token.org.snakeyaml.engine.v2.tokens.TokenpeekToken()Return the next token, but do not delete it from the stream.voidresetDocumentIndex()Set the document index to 0 after a document end-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, remove
-
-
-
-
Method Detail
-
checkToken
boolean checkToken(org.snakeyaml.engine.v2.tokens.Token.ID... choices)
Check if the next token is one of the given types.- Parameters:
choices- token IDs to match with- Returns:
trueif the next token is one of the given types. Returnsfalseif no more tokens are available.- Throws:
ScannerException- Thrown in case of malformed input.
-
peekToken
org.snakeyaml.engine.v2.tokens.Token peekToken()
Return the next token, but do not delete it from the stream.- Returns:
- The token that will be returned on the next call to
next() - Throws:
ScannerException- Thrown in case of malformed input.IndexOutOfBoundsException- if no more token left
-
next
org.snakeyaml.engine.v2.tokens.Token next()
Returns the next token.The token will be removed from the stream. (Every invocation of this method must happen after calling either
checkToken(org.snakeyaml.engine.v2.tokens.Token.ID...)orpeekToken()- Specified by:
nextin interfaceIterator<org.snakeyaml.engine.v2.tokens.Token>- Returns:
- the coming token
- Throws:
ScannerException- Thrown in case of malformed input.IndexOutOfBoundsException- if no more token left
-
resetDocumentIndex
void resetDocumentIndex()
Set the document index to 0 after a document end
-
-