# Scanner

public final class **Scanner** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> [Closeable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html) A simple text scanner which can parse primitive types and strings using
regular expressions.

A `Scanner` breaks its input into tokens using a
delimiter pattern, which by default matches whitespace. The resulting
tokens may then be converted into values of different types using the
various next methods.

For example, this code allows a user to read a number from
System.in:
>
>     Scanner sc = new Scanner(System.in);
>          int i = sc.nextInt();
>      
As another example, this code allows `long` types to be
assigned from entries in a file `myNumbers`:
>
>     Scanner sc = new Scanner(new File("myNumbers"));
>           while (sc.hasNextLong()) {
>               long aLong = sc.nextLong();
>           }
>      
The scanner can also use delimiters other than whitespace. This
example reads several items in from a string:
>
>     String input = "1 fish 2 fish red fish blue fish";
>          Scanner s = new Scanner(input).useDelimiter("\\s*fish\\s*");
>          System.out.println(s.nextInt());
>          System.out.println(s.nextInt());
>          System.out.println(s.next());
>          System.out.println(s.next());
>          s.close();
>      

prints the following output:
>
>     1
>          2
>          red
>          blue
>      
The same output can be generated with this code, which uses a regular
expression to parse all four tokens at once:
>
>     String input = "1 fish 2 fish red fish blue fish";
>          Scanner s = new Scanner(input);
>          s.findInLine("(\\d+) fish (\\d+) fish (\\w+) fish (\\w+)");
>          MatchResult result = s.match();
>          for (int i=1; i<=result.groupCount(); i++)
>              System.out.println(result.group(i));
>          s.close();
>      
The default whitespace delimiter used
by a scanner is as recognized by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html`.`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#isWhitespace(char)`. The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#reset()`
method will reset the value of the scanner's delimiter to the default
whitespace delimiter regardless of whether it was previously changed.

A scanning operation may block waiting for input.

The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#next()` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNext()` methods and their
primitive-type companion methods (such as `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt()` and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextInt()`) first skip any input that matches the delimiter
pattern, and then attempt to return the next token. Both hasNext
and next methods may block waiting for further input. Whether a
hasNext method blocks has no connection to whether or not its
associated next method will block.

The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findInLine(java.lang.String)`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findWithinHorizon(java.lang.String,%20int)`, and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#skip(java.lang.String)`
methods operate independently of the delimiter pattern. These methods will
attempt to match the specified pattern with no regard to delimiters in the
input and thus can be used in special circumstances where delimiters are
not relevant. These methods may block waiting for more input.

When a scanner throws an `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html`, the scanner
will not pass the token that caused the exception, so that it may be
retrieved or skipped via some other method.

Depending upon the type of delimiting pattern, empty tokens may be
returned. For example, the pattern "\\\\s+" will return no empty
tokens since it matches multiple instances of the delimiter. The delimiting
pattern "\\\\s" could return empty tokens since it only passes one
space at a time.

A scanner can read text from any object which implements the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Readable.html` interface. If an invocation of the underlying
readable's `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Readable.html#read(java.nio.CharBuffer)` method throws an `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html` then the scanner assumes that the end of the input
has been reached. The most recent IOException thrown by the
underlying readable can be retrieved via the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#ioException()` method.

When a `Scanner` is closed, it will close its input source
if the source implements the `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html` interface.

A `Scanner` is not safe for multithreaded use without
external synchronization.

Unless otherwise mentioned, passing a `null` parameter into
any method of a `Scanner` will cause a
`NullPointerException` to be thrown.

A scanner will default to interpreting numbers as decimal unless a
different radix has been set by using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useRadix(int)` method. The
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#reset()` method will reset the value of the scanner's radix to
`10` regardless of whether it was previously changed.

### Localized numbers

An instance of this class is capable of scanning numbers in the standard
formats as well as in the formats of the scanner's locale. A scanner's
initial locale is the value returned by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html#getDefault(java.util.Locale.Category)` method; it may be changed via the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useLocale(java.util.Locale)` method. The `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#reset()` method will reset the value of the
scanner's locale to the initial locale regardless of whether it was
previously changed.

The localized formats are defined in terms of the following parameters,
which for a particular locale are taken from that locale's `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormat.html` object, df, and its and
`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormatSymbols.html` object,
dfs.

> *LocalGroupSeparator *
> :   The character used to separate thousands groups,
>     *i.e.,* dfs.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormatSymbols.html#getGroupingSeparator()`
>
> *LocalDecimalSeparator *
> :   The character used for the decimal point,
>     *i.e.,* dfs.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormatSymbols.html#getDecimalSeparator()`
>
> *LocalPositivePrefix *
> :   The string that appears before a positive number (may
>     be empty), *i.e.,* df.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormat.html#getPositivePrefix()`
>
> *LocalPositiveSuffix *
> :   The string that appears after a positive number (may be
>     empty), *i.e.,* df.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormat.html#getPositiveSuffix()`
>
> *LocalNegativePrefix *
> :   The string that appears before a negative number (may
>     be empty), *i.e.,* df.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormat.html#getNegativePrefix()`
>
> *LocalNegativeSuffix *
> :   The string that appears after a negative number (may be
>     empty), *i.e.,* df.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormat.html#getNegativeSuffix()`
>
> *LocalNaN *
> :   The string that represents not-a-number for
>     floating-point values,
>     *i.e.,* dfs.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormatSymbols.html#getNaN()`
>
> *LocalInfinity *
> :   The string that represents infinity for floating-point
>     values, *i.e.,* dfs.`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DecimalFormatSymbols.html#getInfinity()`

#### Number syntax

The strings that can be parsed as numbers by an instance of this class
are specified in terms of the following regular-expression grammar, where
Rmax is the highest digit in the radix being used (for example, Rmax is 9 in base 10).

*NonAsciiDigit*:
:   A non-ASCII character c for which
    `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#isDigit(char)`(c)
    returns true

*Non0Digit*:
:   \[1-*Rmax*\] \| *NonASCIIDigit*

*Digit*:
:   \[0-*Rmax*\] \| *NonASCIIDigit*

*GroupedNumeral*:
:   ( *Non0Digit*
    *Digit*? *Digit*?
:   ( *LocalGroupSeparator*
    *Digit*
    *Digit*
    *Digit* )+ )

*Numeral*:
:   ( ( *Digit*+ ) \| *GroupedNumeral* )

*Integer*:
:   ( \[-+\]? ( *Numeral* ) )
:   \| *LocalPositivePrefix* *Numeral*
    *LocalPositiveSuffix*
:   \| *LocalNegativePrefix* *Numeral*
    *LocalNegativeSuffix*

*DecimalNumeral*:
:   *Numeral*
:   \| *Numeral*
    *LocalDecimalSeparator*
    *Digit*\*
:   \| *LocalDecimalSeparator*
    *Digit*+

*Exponent*:
:   ( \[eE\] \[+-\]? *Digit*+ )

*Decimal*:
:   ( \[-+\]? *DecimalNumeral*
    *Exponent*? )
:   \| *LocalPositivePrefix*
    *DecimalNumeral*
    *LocalPositiveSuffix*
    *Exponent*?
:   \| *LocalNegativePrefix*
    *DecimalNumeral*
    *LocalNegativeSuffix*
    *Exponent*?

*HexFloat*:
:   \[-+\]? 0\[xX\]\[0-9a-fA-F\]\*\\.\[0-9a-fA-F\]+ (\[pP\]\[-+\]?\[0-9\]+)?

*NonNumber*:
:   NaN \| *LocalNan* \| Infinity \| *LocalInfinity*

*SignedNonNumber*:
:   ( \[-+\]? *NonNumber* )
:   \| *LocalPositivePrefix*
    *NonNumber*
    *LocalPositiveSuffix*
:   \| *LocalNegativePrefix*
    *NonNumber*
    *LocalNegativeSuffix*

*Float*:
:   *Decimal*
    \| *HexFloat*
    \| *SignedNonNumber*

Whitespace is not significant in the above regular expressions.

### Public Constructor Summary

|---|---|
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.lang.Readable))([Readable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Readable.html) source) Constructs a new `Scanner` that produces values scanned from the specified source. |
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.io.InputStream))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) source) Constructs a new `Scanner` that produces values scanned from the specified input stream. |
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.io.InputStream,%20java.lang.String))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) source, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName) Constructs a new `Scanner` that produces values scanned from the specified input stream. |
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.io.File))([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) source) Constructs a new `Scanner` that produces values scanned from the specified file. |
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.io.File,%20java.lang.String))([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) source, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName) Constructs a new `Scanner` that produces values scanned from the specified file. |
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) source) Constructs a new `Scanner` that produces values scanned from the specified string. |
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.nio.channels.ReadableByteChannel))([ReadableByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ReadableByteChannel.html) source) Constructs a new `Scanner` that produces values scanned from the specified channel. |
|   | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#Scanner(java.nio.channels.ReadableByteChannel,%20java.lang.String))([ReadableByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ReadableByteChannel.html) source, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName) Constructs a new `Scanner` that produces values scanned from the specified channel. |

### Public Method Summary

|---|---|
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#close())() Closes this scanner. |
| [Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) | [delimiter](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#delimiter())() Returns the `Pattern` this `Scanner` is currently using to match delimiters. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [findInLine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findInLine(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern) Attempts to find the next occurrence of a pattern constructed from the specified string, ignoring delimiters. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [findInLine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findInLine(java.util.regex.Pattern))([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [findWithinHorizon](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findWithinHorizon(java.util.regex.Pattern,%20int))([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern, int horizon) Attempts to find the next occurrence of the specified pattern. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [findWithinHorizon](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findWithinHorizon(java.lang.String,%20int))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern, int horizon) Attempts to find the next occurrence of a pattern constructed from the specified string, ignoring delimiters. |
| boolean | [hasNext](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNext())() Returns true if this scanner has another token in its input. |
| boolean | [hasNext](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNext(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern) Returns true if the next token matches the pattern constructed from the specified string. |
| boolean | [hasNext](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNext(java.util.regex.Pattern))([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern) Returns true if the next complete token matches the specified pattern. |
| boolean | [hasNextBigDecimal](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextBigDecimal())() Returns true if the next token in this scanner's input can be interpreted as a `BigDecimal` using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigDecimal()` method. |
| boolean | [hasNextBigInteger](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextBigInteger(int))(int radix) Returns true if the next token in this scanner's input can be interpreted as a `BigInteger` in the specified radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigInteger()` method. |
| boolean | [hasNextBigInteger](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextBigInteger())() Returns true if the next token in this scanner's input can be interpreted as a `BigInteger` in the default radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigInteger()` method. |
| boolean | [hasNextBoolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextBoolean())() Returns true if the next token in this scanner's input can be interpreted as a boolean value using a case insensitive pattern created from the string "true\|false". |
| boolean | [hasNextByte](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextByte())() Returns true if the next token in this scanner's input can be interpreted as a byte value in the default radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextByte()` method. |
| boolean | [hasNextByte](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextByte(int))(int radix) Returns true if the next token in this scanner's input can be interpreted as a byte value in the specified radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextByte()` method. |
| boolean | [hasNextDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextDouble())() Returns true if the next token in this scanner's input can be interpreted as a double value using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextDouble()` method. |
| boolean | [hasNextFloat](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextFloat())() Returns true if the next token in this scanner's input can be interpreted as a float value using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextFloat()` method. |
| boolean | [hasNextInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextInt())() Returns true if the next token in this scanner's input can be interpreted as an int value in the default radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt()` method. |
| boolean | [hasNextInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextInt(int))(int radix) Returns true if the next token in this scanner's input can be interpreted as an int value in the specified radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt()` method. |
| boolean | [hasNextLine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextLine())() Returns true if there is another line in the input of this scanner. |
| boolean | [hasNextLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextLong())() Returns true if the next token in this scanner's input can be interpreted as a long value in the default radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextLong()` method. |
| boolean | [hasNextLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextLong(int))(int radix) Returns true if the next token in this scanner's input can be interpreted as a long value in the specified radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextLong()` method. |
| boolean | [hasNextShort](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextShort())() Returns true if the next token in this scanner's input can be interpreted as a short value in the default radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextShort()` method. |
| boolean | [hasNextShort](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNextShort(int))(int radix) Returns true if the next token in this scanner's input can be interpreted as a short value in the specified radix using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextShort()` method. |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | [ioException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#ioException())() Returns the `IOException` last thrown by this `Scanner`'s underlying `Readable`. |
| [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) | [locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#locale())() Returns this scanner's locale. |
| [MatchResult](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/MatchResult.html) | [match](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#match())() Returns the match result of the last scanning operation performed by this scanner. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [next](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#next(java.util.regex.Pattern))([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern) Returns the next token if it matches the specified pattern. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [next](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#next())() Finds and returns the next complete token from this scanner. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [next](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#next(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern) Returns the next token if it matches the pattern constructed from the specified string. |
| BigDecimal | [nextBigDecimal](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigDecimal())() Scans the next token of the input as a `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigDecimal.html`. |
| BigInteger | [nextBigInteger](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigInteger())() Scans the next token of the input as a `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigInteger.html`. |
| BigInteger | [nextBigInteger](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigInteger(int))(int radix) Scans the next token of the input as a `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigInteger.html`. |
| boolean | [nextBoolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBoolean())() Scans the next token of the input into a boolean value and returns that value. |
| byte | [nextByte](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextByte(int))(int radix) Scans the next token of the input as a byte. |
| byte | [nextByte](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextByte())() Scans the next token of the input as a byte. |
| double | [nextDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextDouble())() Scans the next token of the input as a double. |
| float | [nextFloat](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextFloat())() Scans the next token of the input as a float. |
| int | [nextInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt())() Scans the next token of the input as an int. |
| int | [nextInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt(int))(int radix) Scans the next token of the input as an int. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [nextLine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextLine())() Advances this scanner past the current line and returns the input that was skipped. |
| long | [nextLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextLong())() Scans the next token of the input as a long. |
| long | [nextLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextLong(int))(int radix) Scans the next token of the input as a long. |
| short | [nextShort](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextShort(int))(int radix) Scans the next token of the input as a short. |
| short | [nextShort](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextShort())() Scans the next token of the input as a short. |
| int | [radix](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#radix())() Returns this scanner's default radix. |
| void | [remove](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#remove())() The remove operation is not supported by this implementation of `Iterator`. |
| [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | [reset](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#reset())() Resets this scanner. |
| [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | [skip](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#skip(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern) Skips input that matches a pattern constructed from the specified string. |
| [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | [skip](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#skip(java.util.regex.Pattern))([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern) Skips input that matches the specified pattern, ignoring delimiters. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#toString())() Returns the string representation of this `Scanner`. |
| [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | [useDelimiter](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useDelimiter(java.util.regex.Pattern))([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern) Sets this scanner's delimiting pattern to the specified pattern. |
| [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | [useDelimiter](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useDelimiter(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern) Sets this scanner's delimiting pattern to a pattern constructed from the specified `String`. |
| [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | [useLocale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useLocale(java.util.Locale))([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Sets this scanner's locale to the specified locale. |
| [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | [useRadix](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useRadix(int))(int radix) Sets this scanner's default radix to the specified radix. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.util.Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)

|---|---|
| void | [forEachRemaining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html#forEachRemaining(java.util.function.Consumer<?%20super%20E>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super E\> action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |
| abstract boolean | [hasNext](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html#hasNext())() Returns `true` if the iteration has more elements. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [next](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html#next())() Returns the next element in the iteration. |
| void | [remove](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html#remove())() Removes from the underlying collection the last element returned by this iterator (optional operation). |

From interface [java.io.Closeable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html#close())() Closes this stream and releases any system resources associated with it. |

From interface [java.lang.AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Public Constructors

#### public
**Scanner**
([Readable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Readable.html) source)

Constructs a new `Scanner` that produces values scanned
from the specified source.

##### Parameters

| source | A character source implementing the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Readable.html` interface |
|---|---|

#### public
**Scanner**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) source)

Constructs a new `Scanner` that produces values scanned
from the specified input stream. Bytes from the stream are converted
into characters using the underlying platform's
{@linkplain java.nio.charset.Charset#defaultCharset() default charset}.

##### Parameters

| source | An input stream to be scanned |
|---|---|

#### public
**Scanner**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) source, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName)

Constructs a new `Scanner` that produces values scanned
from the specified input stream. Bytes from the stream are converted
into characters using the specified charset.

##### Parameters

| source | An input stream to be scanned |
| charsetName | The encoding type used to convert bytes from the stream into characters to be scanned |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the specified character set does not exist |
|---|---|

#### public
**Scanner**
([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) source)

Constructs a new `Scanner` that produces values scanned
from the specified file. Bytes from the file are converted into
characters using the underlying platform's
{@linkplain java.nio.charset.Charset#defaultCharset() default charset}.

##### Parameters

| source | A file to be scanned |
|---|---|

##### Throws

| [FileNotFoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FileNotFoundException.html) | if source is not found |
|---|---|

#### public
**Scanner**
([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) source, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName)

Constructs a new `Scanner` that produces values scanned
from the specified file. Bytes from the file are converted into
characters using the specified charset.

##### Parameters

| source | A file to be scanned |
| charsetName | The encoding type used to convert bytes from the file into characters to be scanned |
|---|---|

##### Throws

| [FileNotFoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FileNotFoundException.html) | if source is not found |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the specified encoding is not found |
|---|---|

#### public
**Scanner**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) source)

Constructs a new `Scanner` that produces values scanned
from the specified string.

##### Parameters

| source | A string to scan |
|---|---|

#### public
**Scanner**
([ReadableByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ReadableByteChannel.html) source)

Constructs a new `Scanner` that produces values scanned
from the specified channel. Bytes from the source are converted into
characters using the underlying platform's
{@linkplain java.nio.charset.Charset#defaultCharset() default charset}.

##### Parameters

| source | A channel to scan |
|---|---|

#### public
**Scanner**
([ReadableByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ReadableByteChannel.html) source, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName)

Constructs a new `Scanner` that produces values scanned
from the specified channel. Bytes from the source are converted into
characters using the specified charset.

##### Parameters

| source | A channel to scan |
| charsetName | The encoding type used to convert bytes from the channel into characters to be scanned |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the specified character set does not exist |
|---|---|

## Public Methods

#### public void
**close**
()

Closes this scanner.

If this scanner has not yet been closed then if its underlying
{@linkplain java.lang.Readable readable} also implements the `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html` interface then the readable's close method
will be invoked. If this scanner is already closed then invoking this
method will have no effect.

Attempting to perform search operations after a scanner has
been closed will result in an `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html`.

#### public [Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html)
**delimiter**
()

Returns the `Pattern` this `Scanner` is currently
using to match delimiters.

##### Returns

- this scanner's delimiting pattern.

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**findInLine**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern)

Attempts to find the next occurrence of a pattern constructed from the
specified string, ignoring delimiters.

An invocation of this method of the form findInLine(pattern)
behaves in exactly the same way as the invocation
findInLine(Pattern.compile(pattern)).

##### Parameters

| pattern | a string specifying the pattern to search for |
|---|---|

##### Returns

- the text that matched the specified pattern

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**findInLine**
([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern)

Attempts to find the next occurrence of the specified pattern ignoring
delimiters. If the pattern is found before the next line separator, the
scanner advances past the input that matched and returns the string that
matched the pattern.
If no such pattern is detected in the input up to the next line
separator, then `null` is returned and the scanner's
position is unchanged. This method may block waiting for input that
matches the pattern.

Since this method continues to search through the input looking
for the specified pattern, it may buffer all of the input searching for
the desired token if no line separators are present.

##### Parameters

| pattern | the pattern to scan for |
|---|---|

##### Returns

- the text that matched the specified pattern

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**findWithinHorizon**
([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern, int horizon)

Attempts to find the next occurrence of the specified pattern.

This method searches through the input up to the specified
search horizon, ignoring delimiters. If the pattern is found the
scanner advances past the input that matched and returns the string
that matched the pattern. If no such pattern is detected then the
null is returned and the scanner's position remains unchanged. This
method may block waiting for input that matches the pattern.

A scanner will never search more than `horizon` code
points beyond its current position. Note that a match may be clipped
by the horizon; that is, an arbitrary match result may have been
different if the horizon had been larger. The scanner treats the
horizon as a transparent, non-anchoring bound (see `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Matcher.html#useTransparentBounds(boolean)` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Matcher.html#useAnchoringBounds(boolean)`).

If horizon is `0`, then the horizon is ignored and
this method continues to search through the input looking for the
specified pattern without bound. In this case it may buffer all of
the input searching for the pattern.

If horizon is negative, then an IllegalArgumentException is
thrown.

##### Parameters

| pattern | the pattern to scan for |
| horizon | the search horizon |
|---|---|

##### Returns

- the text that matched the specified pattern

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if horizon is negative |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**findWithinHorizon**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern, int horizon)

Attempts to find the next occurrence of a pattern constructed from the
specified string, ignoring delimiters.

An invocation of this method of the form
findWithinHorizon(pattern) behaves in exactly the same way as
the invocation
findWithinHorizon(Pattern.compile(pattern, horizon)).

##### Parameters

| pattern | a string specifying the pattern to search for |
| horizon | the search horizon |
|---|---|

##### Returns

- the text that matched the specified pattern

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if horizon is negative |
|---|---|

#### public boolean
**hasNext**
()

Returns true if this scanner has another token in its input.
This method may block while waiting for input to scan.
The scanner does not advance past any input.

##### Returns

- true if and only if this scanner has another token

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html`

#### public boolean
**hasNext**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern)

Returns true if the next token matches the pattern constructed from the
specified string. The scanner does not advance past any input.

An invocation of this method of the form hasNext(pattern)
behaves in exactly the same way as the invocation
hasNext(Pattern.compile(pattern)).

##### Parameters

| pattern | a string specifying the pattern to scan |
|---|---|

##### Returns

- true if and only if this scanner has another token matching the specified pattern

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNext**
([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern)

Returns true if the next complete token matches the specified pattern.
A complete token is prefixed and postfixed by input that matches
the delimiter pattern. This method may block while waiting for input.
The scanner does not advance past any input.

##### Parameters

| pattern | the pattern to scan for |
|---|---|

##### Returns

- true if and only if this scanner has another token matching the specified pattern

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextBigDecimal**
()

Returns true if the next token in this scanner's input can be
interpreted as a `BigDecimal` using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigDecimal()` method. The scanner does not advance past any
input.

##### Returns

- true if and only if this scanner's next token is a valid `BigDecimal`

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextBigInteger**
(int radix)

Returns true if the next token in this scanner's input can be
interpreted as a `BigInteger` in the specified radix using
the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigInteger()` method. The scanner does not advance past
any input.

##### Parameters

| radix | the radix used to interpret the token as an integer |
|---|---|

##### Returns

- true if and only if this scanner's next token is a valid `BigInteger`

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextBigInteger**
()

Returns true if the next token in this scanner's input can be
interpreted as a `BigInteger` in the default radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextBigInteger()` method. The scanner does not advance past any
input.

##### Returns

- true if and only if this scanner's next token is a valid `BigInteger`

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextBoolean**
()

Returns true if the next token in this scanner's input can be
interpreted as a boolean value using a case insensitive pattern
created from the string "true\|false". The scanner does not
advance past the input that matched.

##### Returns

- true if and only if this scanner's next token is a valid boolean value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextByte**
()

Returns true if the next token in this scanner's input can be
interpreted as a byte value in the default radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextByte()` method. The scanner does not advance past any input.

##### Returns

- true if and only if this scanner's next token is a valid byte value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextByte**
(int radix)

Returns true if the next token in this scanner's input can be
interpreted as a byte value in the specified radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextByte()` method. The scanner does not advance past any input.

##### Parameters

| radix | the radix used to interpret the token as a byte value |
|---|---|

##### Returns

- true if and only if this scanner's next token is a valid byte value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextDouble**
()

Returns true if the next token in this scanner's input can be
interpreted as a double value using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextDouble()`
method. The scanner does not advance past any input.

##### Returns

- true if and only if this scanner's next token is a valid double value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextFloat**
()

Returns true if the next token in this scanner's input can be
interpreted as a float value using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextFloat()`
method. The scanner does not advance past any input.

##### Returns

- true if and only if this scanner's next token is a valid float value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextInt**
()

Returns true if the next token in this scanner's input can be
interpreted as an int value in the default radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt()` method. The scanner does not advance past any input.

##### Returns

- true if and only if this scanner's next token is a valid int value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextInt**
(int radix)

Returns true if the next token in this scanner's input can be
interpreted as an int value in the specified radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt()` method. The scanner does not advance past any input.

##### Parameters

| radix | the radix used to interpret the token as an int value |
|---|---|

##### Returns

- true if and only if this scanner's next token is a valid int value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextLine**
()

Returns true if there is another line in the input of this scanner.
This method may block while waiting for input. The scanner does not
advance past any input.

##### Returns

- true if and only if this scanner has another line of input

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextLong**
()

Returns true if the next token in this scanner's input can be
interpreted as a long value in the default radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextLong()` method. The scanner does not advance past any input.

##### Returns

- true if and only if this scanner's next token is a valid long value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextLong**
(int radix)

Returns true if the next token in this scanner's input can be
interpreted as a long value in the specified radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextLong()` method. The scanner does not advance past any input.

##### Parameters

| radix | the radix used to interpret the token as a long value |
|---|---|

##### Returns

- true if and only if this scanner's next token is a valid long value

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextShort**
()

Returns true if the next token in this scanner's input can be
interpreted as a short value in the default radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextShort()` method. The scanner does not advance past any input.

##### Returns

- true if and only if this scanner's next token is a valid short value in the default radix

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**hasNextShort**
(int radix)

Returns true if the next token in this scanner's input can be
interpreted as a short value in the specified radix using the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextShort()` method. The scanner does not advance past any input.

##### Parameters

| radix | the radix used to interpret the token as a short value |
|---|---|

##### Returns

- true if and only if this scanner's next token is a valid short value in the specified radix

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html)
**ioException**
()

Returns the `IOException` last thrown by this
`Scanner`'s underlying `Readable`. This method
returns `null` if no such exception exists.

##### Returns

- the last exception thrown by this scanner's readable

#### public [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html)
**locale**
()

Returns this scanner's locale.

A scanner's locale affects many elements of its default
primitive matching regular expressions; see
[localized numbers](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#localized-numbers) above.

##### Returns

- this scanner's locale

#### public [MatchResult](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/MatchResult.html)
**match**
()

Returns the match result of the last scanning operation performed
by this scanner. This method throws `IllegalStateException`
if no match has been performed, or if the last match was
not successful.

The various `next`methods of `Scanner`
make a match result available if they complete without throwing an
exception. For instance, after an invocation of the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#nextInt()`
method that returned an int, this method returns a
`MatchResult` for the search of the
[*Integer*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Integer-regex) regular expression
defined above. Similarly the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findInLine(java.lang.String)`,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#findWithinHorizon(java.lang.String,%20int)`, and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#skip(java.lang.String)` methods will make a
match available if they succeed.

##### Returns

- a match result for the last match operation

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | If no match result is available |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**next**
([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern)

Returns the next token if it matches the specified pattern. This
method may block while waiting for input to scan, even if a previous
invocation of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNext(java.util.regex.Pattern)` returned `true`.
If the match is successful, the scanner advances past the input that
matched the pattern.

##### Parameters

| pattern | the pattern to scan for |
|---|---|

##### Returns

- the next token

##### Throws

| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if no more tokens are available |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**next**
()

Finds and returns the next complete token from this scanner.
A complete token is preceded and followed by input that matches
the delimiter pattern. This method may block while waiting for input
to scan, even if a previous invocation of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#hasNext()` returned
`true`.

##### Returns

- the next token

##### Throws

| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if no more tokens are available |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**next**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern)

Returns the next token if it matches the pattern constructed from the
specified string. If the match is successful, the scanner advances
past the input that matched the pattern.

An invocation of this method of the form next(pattern)
behaves in exactly the same way as the invocation
next(Pattern.compile(pattern)).

##### Parameters

| pattern | a string specifying the pattern to scan |
|---|---|

##### Returns

- the next token

##### Throws

| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if no such tokens are available |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public BigDecimal
**nextBigDecimal**
()

Scans the next token of the input as a `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigDecimal.html`.

If the next token matches the [*Decimal*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Decimal-regex) regular expression defined
above then the token is converted into a BigDecimal value as if
by removing all group separators, mapping non-ASCII digits into ASCII
digits via the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, and passing the
resulting string to the `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigDecimal.html#BigDecimal(java.lang.String)`
constructor.

##### Returns

- the BigDecimal scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Decimal* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if the input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public BigInteger
**nextBigInteger**
()

Scans the next token of the input as a `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigInteger.html`.

An invocation of this method of the form
nextBigInteger() behaves in exactly the same way as the
invocation nextBigInteger(radix), where `radix`
is the default radix of this scanner.

##### Returns

- the BigInteger scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if the input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public BigInteger
**nextBigInteger**
(int radix)

Scans the next token of the input as a `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigInteger.html`.

If the next token matches the [*Integer*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Integer-regex) regular expression defined
above then the token is converted into a BigInteger value as if
by removing all group separators, mapping non-ASCII digits into ASCII
digits via the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, and passing the
resulting string to the `https://developers.google.com/j2objc/javadoc/jre/reference/java/math/BigInteger.html#BigInteger(java.lang.String)` constructor with the specified radix.

##### Parameters

| radix | the radix used to interpret the token |
|---|---|

##### Returns

- the BigInteger scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if the input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public boolean
**nextBoolean**
()

Scans the next token of the input into a boolean value and returns
that value. This method will throw `InputMismatchException`
if the next token cannot be translated into a valid boolean value.
If the match is successful, the scanner advances past the input that
matched.

##### Returns

- the boolean scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token is not a valid boolean |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public byte
**nextByte**
(int radix)

Scans the next token of the input as a byte.
This method will throw `InputMismatchException`
if the next token cannot be translated into a valid byte value as
described below. If the translation is successful, the scanner advances
past the input that matched.

If the next token matches the [*Integer*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Integer-regex) regular expression defined
above then the token is converted into a byte value as if by
removing all locale specific prefixes, group separators, and locale
specific suffixes, then mapping non-ASCII digits into ASCII
digits via `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, prepending a
negative sign (-) if the locale specific negative prefixes and suffixes
were present, and passing the resulting string to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Byte.html#parseByte(java.lang.String,%20int)` with the
specified radix.

##### Parameters

| radix | the radix used to interpret the token as a byte value |
|---|---|

##### Returns

- the byte scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public byte
**nextByte**
()

Scans the next token of the input as a byte.

An invocation of this method of the form
nextByte() behaves in exactly the same way as the
invocation nextByte(radix), where `radix`
is the default radix of this scanner.

##### Returns

- the byte scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public double
**nextDouble**
()

Scans the next token of the input as a double.
This method will throw `InputMismatchException`
if the next token cannot be translated into a valid double value.
If the translation is successful, the scanner advances past the input
that matched.

If the next token matches the [*Float*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Float-regex) regular expression defined above
then the token is converted into a double value as if by
removing all locale specific prefixes, group separators, and locale
specific suffixes, then mapping non-ASCII digits into ASCII
digits via `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, prepending a
negative sign (-) if the locale specific negative prefixes and suffixes
were present, and passing the resulting string to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html#parseDouble(java.lang.String)`. If the token matches
the localized NaN or infinity strings, then either "Nan" or "Infinity"
is passed to `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html#parseDouble(java.lang.String)` as
appropriate.

##### Returns

- the double scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Float* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if the input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public float
**nextFloat**
()

Scans the next token of the input as a float.
This method will throw `InputMismatchException`
if the next token cannot be translated into a valid float value as
described below. If the translation is successful, the scanner advances
past the input that matched.

If the next token matches the [*Float*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Float-regex) regular expression defined above
then the token is converted into a float value as if by
removing all locale specific prefixes, group separators, and locale
specific suffixes, then mapping non-ASCII digits into ASCII
digits via `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, prepending a
negative sign (-) if the locale specific negative prefixes and suffixes
were present, and passing the resulting string to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Float.html#parseFloat(java.lang.String)`. If the token matches
the localized NaN or infinity strings, then either "Nan" or "Infinity"
is passed to `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Float.html#parseFloat(java.lang.String)` as
appropriate.

##### Returns

- the float scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Float* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public int
**nextInt**
()

Scans the next token of the input as an int.

An invocation of this method of the form
nextInt() behaves in exactly the same way as the
invocation nextInt(radix), where `radix`
is the default radix of this scanner.

##### Returns

- the int scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public int
**nextInt**
(int radix)

Scans the next token of the input as an int.
This method will throw `InputMismatchException`
if the next token cannot be translated into a valid int value as
described below. If the translation is successful, the scanner advances
past the input that matched.

If the next token matches the [*Integer*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Integer-regex) regular expression defined
above then the token is converted into an int value as if by
removing all locale specific prefixes, group separators, and locale
specific suffixes, then mapping non-ASCII digits into ASCII
digits via `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, prepending a
negative sign (-) if the locale specific negative prefixes and suffixes
were present, and passing the resulting string to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Integer.html#parseInt(java.lang.String,%20int)` with the
specified radix.

##### Parameters

| radix | the radix used to interpret the token as an int value |
|---|---|

##### Returns

- the int scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**nextLine**
()

Advances this scanner past the current line and returns the input
that was skipped.

This method returns the rest of the current line, excluding any line
separator at the end. The position is set to the beginning of the next
line.

Since this method continues to search through the input looking
for a line separator, it may buffer all of the input searching for
the line to skip if no line separators are present.

##### Returns

- the line that was skipped

##### Throws

| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if no line was found |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public long
**nextLong**
()

Scans the next token of the input as a long.

An invocation of this method of the form
nextLong() behaves in exactly the same way as the
invocation nextLong(radix), where `radix`
is the default radix of this scanner.

##### Returns

- the long scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public long
**nextLong**
(int radix)

Scans the next token of the input as a long.
This method will throw `InputMismatchException`
if the next token cannot be translated into a valid long value as
described below. If the translation is successful, the scanner advances
past the input that matched.

If the next token matches the [*Integer*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Integer-regex) regular expression defined
above then the token is converted into a long value as if by
removing all locale specific prefixes, group separators, and locale
specific suffixes, then mapping non-ASCII digits into ASCII
digits via `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, prepending a
negative sign (-) if the locale specific negative prefixes and suffixes
were present, and passing the resulting string to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html#parseLong(java.lang.String,%20int)` with the
specified radix.

##### Parameters

| radix | the radix used to interpret the token as an int value |
|---|---|

##### Returns

- the long scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public short
**nextShort**
(int radix)

Scans the next token of the input as a short.
This method will throw `InputMismatchException`
if the next token cannot be translated into a valid short value as
described below. If the translation is successful, the scanner advances
past the input that matched.

If the next token matches the [*Integer*](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#Integer-regex) regular expression defined
above then the token is converted into a short value as if by
removing all locale specific prefixes, group separators, and locale
specific suffixes, then mapping non-ASCII digits into ASCII
digits via `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#digit(char,%20int)`, prepending a
negative sign (-) if the locale specific negative prefixes and suffixes
were present, and passing the resulting string to
`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Short.html#parseShort(java.lang.String,%20int)` with the
specified radix.

##### Parameters

| radix | the radix used to interpret the token as a short value |
|---|---|

##### Returns

- the short scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public short
**nextShort**
()

Scans the next token of the input as a short.

An invocation of this method of the form
nextShort() behaves in exactly the same way as the
invocation nextShort(radix), where `radix`
is the default radix of this scanner.

##### Returns

- the short scanned from the input

##### Throws

| [InputMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/InputMismatchException.html) | if the next token does not match the *Integer* regular expression, or is out of range |
| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if input is exhausted |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public int
**radix**
()

Returns this scanner's default radix.

A scanner's radix affects elements of its default
number matching regular expressions; see
[localized numbers](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#localized-numbers) above.

##### Returns

- the default radix of this scanner

#### public void
**remove**
()

The remove operation is not supported by this implementation of
`Iterator`.

##### Throws

| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | if this method is invoked. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html`

#### public [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html)
**reset**
()

Resets this scanner.

Resetting a scanner discards all of its explicit state
information which may have been changed by invocations of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useDelimiter(java.lang.String)`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useLocale(java.util.Locale)`, or `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#useRadix(int)`.

An invocation of this method of the form
scanner.reset() behaves in exactly the same way as the
invocation

>     scanner.useDelimiter("\\p{javaWhitespace}+")
>               .useLocale(Locale.getDefault(Locale.Category.FORMAT))
>               .useRadix(10);
>      
<br />

##### Returns

- this scanner

#### public [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html)
**skip**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern)

Skips input that matches a pattern constructed from the specified
string.

An invocation of this method of the form skip(pattern)
behaves in exactly the same way as the invocation
skip(Pattern.compile(pattern)).

##### Parameters

| pattern | a string specifying the pattern to skip over |
|---|---|

##### Returns

- this scanner

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html)
**skip**
([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern)

Skips input that matches the specified pattern, ignoring delimiters.
This method will skip input if an anchored match of the specified
pattern succeeds.

If a match to the specified pattern is not found at the
current position, then no input is skipped and a
NoSuchElementException is thrown.

Since this method seeks to match the specified pattern starting at
the scanner's current position, patterns that can match a lot of
input (".\*", for example) may cause the scanner to buffer a large
amount of input.

Note that it is possible to skip something without risking a
`NoSuchElementException` by using a pattern that can
match nothing, e.g., `sc.skip("[ \t]*")`.

##### Parameters

| pattern | a string specifying the pattern to skip over |
|---|---|

##### Returns

- this scanner

##### Throws

| [NoSuchElementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/NoSuchElementException.html) | if the specified pattern is not found |
| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if this scanner is closed |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

<br />

Returns the string representation of this `Scanner`. The
string representation of a `Scanner` contains information
that may be useful for debugging. The exact format is unspecified.

##### Returns

- The string representation of this scanner

#### public [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html)
**useDelimiter**
([Pattern](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/Pattern.html) pattern)

Sets this scanner's delimiting pattern to the specified pattern.

##### Parameters

| pattern | A delimiting pattern |
|---|---|

##### Returns

- this scanner

#### public [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html)
**useDelimiter**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) pattern)

Sets this scanner's delimiting pattern to a pattern constructed from
the specified `String`.

An invocation of this method of the form
useDelimiter(pattern) behaves in exactly the same way as the
invocation useDelimiter(Pattern.compile(pattern)).

Invoking the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#reset()` method will set the scanner's delimiter
to the [default](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#default-delimiter).

##### Parameters

| pattern | A string specifying a delimiting pattern |
|---|---|

##### Returns

- this scanner

#### public [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html)
**useLocale**
([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale)

Sets this scanner's locale to the specified locale.

A scanner's locale affects many elements of its default
primitive matching regular expressions; see
[localized numbers](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#localized-numbers) above.

Invoking the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#reset()` method will set the scanner's locale to
the [initial locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#initial-locale).

##### Parameters

| locale | A string specifying the locale to use |
|---|---|

##### Returns

- this scanner

#### public [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html)
**useRadix**
(int radix)

Sets this scanner's default radix to the specified radix.

A scanner's radix affects elements of its default
number matching regular expressions; see
[localized numbers](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner#localized-numbers) above.

If the radix is less than `Character.MIN_RADIX`
or greater than `Character.MAX_RADIX`, then an
`IllegalArgumentException` is thrown.

Invoking the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html#reset()` method will set the scanner's radix to
`10`.

##### Parameters

| radix | The radix to use when scanning numbers |
|---|---|

##### Returns

- this scanner

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if radix is out of range |
|---|---|