org.yaml.snakeyaml.scanner

## Interface Scanner

All Known Implementing Classes:
  ScannerImpl

    public interface Scanner

This interface represents an input stream of `Token`s.

The parser and the scanner form together the 'Parse' step in the loading process (see chapter 3.1 of the YAML Specification).

See Also:
  `Token`

### Method Summary

Methods
`boolean` `checkToken(Token.ID... choices)` Check if the next token is one of the given types.
`Token` `getToken()` Returns the next token.
`Token` `peekToken()` Return the next token, but do not delete it from the stream.

### Method Detail

#### checkToken

    boolean checkToken(Token.ID... choices)

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

Parameters:
  `choices` - token IDs.
Returns:
  `true` if the next token can be assigned to a variable of at least one of the given types. Returns `false` if no more tokens are available.
Throws:
  `ScannerException` - Thrown in case of malformed input.

#### peekToken

    Token peekToken()

Return the next token, but do not delete it from the stream. The method must be called only after `checkToken(org.yaml.snakeyaml.tokens.Token.ID...)`.

Returns:
  The token that will be returned on the next call to `getToken()`
Throws:
  `ScannerException` - Thrown in case of malformed input.
  `IndexOutOfBoundsException` - if no more token left

#### getToken

    Token getToken()

Returns the next token.

The token will be removed from the stream. (Every invocation of this method must happen after calling `checkToken(org.yaml.snakeyaml.tokens.Token.ID...)`.

Returns:
  the coming token
Throws:
  `ScannerException` - Thrown in case of malformed input.
  `IndexOutOfBoundsException` - if no more token left