Top Description Methods
org.snakeyaml.engine.v2.scanner

public Interface Scanner

extends Iterator<Token>
Known Direct Implementers
org.snakeyaml.engine.v2.scanner.ScannerImpl
Imports
java.util.Iterator, org.snakeyaml.engine.v2.exceptions.ScannerException, org.snakeyaml.engine.v2.tokens.Token

This interface represents an input stream of Tokens.

The scanner and the parser form together the 'Parse' step in the loading process.

See Also
3.1. Processes

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the next token is one of the given types. Returns false if no more tokens are available.
checkToken
(Token.ID...
token IDs to match with
choices
)

Check if the next token is one of the given types.

public default boolean

Returns:

true if the next token is the given type. Returns false if no more tokens are available.
checkToken
(Token.ID
token ID to match with
choice
)

Check if the next token is the given type.

public Token

Returns:

the coming token
next
()

Redeclares java.util.Iterator.next.

Returns the next token.

public Token

Returns:

The token that will be returned on the next call to next
peekToken
()

Return the next token, but do not delete it from the stream.

public void
resetDocumentIndex()

Set the document index to 0 after a document end

Inherited from java.util.Iterator:
forEachRemaininghasNextremove

Method Detail

checkTokenback to summary
public boolean checkToken(Token.ID... choices)

Check if the next token is one of the given types.

Parameters
choices:Token.ID[]

token IDs to match with

Returns:boolean

true if the next token is one of the given types. Returns false if no more tokens are available.

Exceptions
ScannerException:
Thrown in case of malformed input.
checkTokenback to summary
public default boolean checkToken(Token.ID choice)

Check if the next token is the given type.

Parameters
choice:Token.ID

token ID to match with

Returns:boolean

true if the next token is the given type. Returns false if no more tokens are available.

Exceptions
ScannerException:
Thrown in case of malformed input.
nextback to summary
public Token next()

Redeclares java.util.Iterator.next.

Returns the next token.

The token will be removed from the stream. (Every invocation of this method must happen after calling either checkToken or peekToken()

Returns:Token

the coming token

Exceptions
ScannerException:
Thrown in case of malformed input.
IndexOutOfBoundsException:
if no more token left
peekTokenback to summary
public Token peekToken()

Return the next token, but do not delete it from the stream.

Returns:Token

The token that will be returned on the next call to next

Exceptions
ScannerException:
Thrown in case of malformed input.
IndexOutOfBoundsException:
if no more token left
resetDocumentIndexback to summary
public void resetDocumentIndex()

Set the document index to 0 after a document end