Scanner (Java Platform SE 7 ) (original) (raw)

Modifier and Type

Method and Description

void

**[close](../../java/util/Scanner.html#close%28%29)**()

Closes this scanner.

[Pattern](../../java/util/regex/Pattern.html "class in java.util.regex")

**[delimiter](../../java/util/Scanner.html#delimiter%28%29)**()

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

[String](../../java/lang/String.html "class in java.lang")

**[findInLine](../../java/util/Scanner.html#findInLine%28java.util.regex.Pattern%29)**([Pattern](../../java/util/regex/Pattern.html "class in java.util.regex") pattern)

Attempts to find the next occurrence of the specified pattern ignoring delimiters.

[String](../../java/lang/String.html "class in java.lang")

**[findInLine](../../java/util/Scanner.html#findInLine%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") pattern)

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

[String](../../java/lang/String.html "class in java.lang")

**[findWithinHorizon](../../java/util/Scanner.html#findWithinHorizon%28java.util.regex.Pattern,%20int%29)**([Pattern](../../java/util/regex/Pattern.html "class in java.util.regex") pattern, int horizon)

Attempts to find the next occurrence of the specified pattern.

[String](../../java/lang/String.html "class in java.lang")

**[findWithinHorizon](../../java/util/Scanner.html#findWithinHorizon%28java.lang.String,%20int%29)**([String](../../java/lang/String.html "class in java.lang") pattern, int horizon)

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

boolean

**[hasNext](../../java/util/Scanner.html#hasNext%28%29)**()

Returns true if this scanner has another token in its input.

boolean

**[hasNext](../../java/util/Scanner.html#hasNext%28java.util.regex.Pattern%29)**([Pattern](../../java/util/regex/Pattern.html "class in java.util.regex") pattern)

Returns true if the next complete token matches the specified pattern.

boolean

**[hasNext](../../java/util/Scanner.html#hasNext%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") pattern)

Returns true if the next token matches the pattern constructed from the specified string.

boolean

**[hasNextBigDecimal](../../java/util/Scanner.html#hasNextBigDecimal%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as a BigDecimal using thenextBigDecimal() method.

boolean

**[hasNextBigInteger](../../java/util/Scanner.html#hasNextBigInteger%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as a BigInteger in the default radix using thenextBigInteger() method.

boolean

**[hasNextBigInteger](../../java/util/Scanner.html#hasNextBigInteger%28int%29)**(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 nextBigInteger() method.

boolean

**[hasNextBoolean](../../java/util/Scanner.html#hasNextBoolean%28%29)**()

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](../../java/util/Scanner.html#hasNextByte%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as a byte value in the default radix using thenextByte() method.

boolean

**[hasNextByte](../../java/util/Scanner.html#hasNextByte%28int%29)**(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 thenextByte() method.

boolean

**[hasNextDouble](../../java/util/Scanner.html#hasNextDouble%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as a double value using the nextDouble() method.

boolean

**[hasNextFloat](../../java/util/Scanner.html#hasNextFloat%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as a float value using the nextFloat() method.

boolean

**[hasNextInt](../../java/util/Scanner.html#hasNextInt%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as an int value in the default radix using thenextInt() method.

boolean

**[hasNextInt](../../java/util/Scanner.html#hasNextInt%28int%29)**(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 thenextInt() method.

boolean

**[hasNextLine](../../java/util/Scanner.html#hasNextLine%28%29)**()

Returns true if there is another line in the input of this scanner.

boolean

**[hasNextLong](../../java/util/Scanner.html#hasNextLong%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as a long value in the default radix using thenextLong() method.

boolean

**[hasNextLong](../../java/util/Scanner.html#hasNextLong%28int%29)**(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 thenextLong() method.

boolean

**[hasNextShort](../../java/util/Scanner.html#hasNextShort%28%29)**()

Returns true if the next token in this scanner's input can be interpreted as a short value in the default radix using thenextShort() method.

boolean

**[hasNextShort](../../java/util/Scanner.html#hasNextShort%28int%29)**(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 thenextShort() method.

[IOException](../../java/io/IOException.html "class in java.io")

**[ioException](../../java/util/Scanner.html#ioException%28%29)**()

Returns the IOException last thrown by thisScanner's underlying Readable.

[Locale](../../java/util/Locale.html "class in java.util")

**[locale](../../java/util/Scanner.html#locale%28%29)**()

Returns this scanner's locale.

[MatchResult](../../java/util/regex/MatchResult.html "interface in java.util.regex")

**[match](../../java/util/Scanner.html#match%28%29)**()

Returns the match result of the last scanning operation performed by this scanner.

[String](../../java/lang/String.html "class in java.lang")

**[next](../../java/util/Scanner.html#next%28%29)**()

Finds and returns the next complete token from this scanner.

[String](../../java/lang/String.html "class in java.lang")

**[next](../../java/util/Scanner.html#next%28java.util.regex.Pattern%29)**([Pattern](../../java/util/regex/Pattern.html "class in java.util.regex") pattern)

Returns the next token if it matches the specified pattern.

[String](../../java/lang/String.html "class in java.lang")

**[next](../../java/util/Scanner.html#next%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") pattern)

Returns the next token if it matches the pattern constructed from the specified string.

[BigDecimal](../../java/math/BigDecimal.html "class in java.math")

**[nextBigDecimal](../../java/util/Scanner.html#nextBigDecimal%28%29)**()

Scans the next token of the input as a BigDecimal.

[BigInteger](../../java/math/BigInteger.html "class in java.math")

**[nextBigInteger](../../java/util/Scanner.html#nextBigInteger%28%29)**()

Scans the next token of the input as a BigInteger.

[BigInteger](../../java/math/BigInteger.html "class in java.math")

**[nextBigInteger](../../java/util/Scanner.html#nextBigInteger%28int%29)**(int radix)

Scans the next token of the input as a BigInteger.

boolean

**[nextBoolean](../../java/util/Scanner.html#nextBoolean%28%29)**()

Scans the next token of the input into a boolean value and returns that value.

byte

**[nextByte](../../java/util/Scanner.html#nextByte%28%29)**()

Scans the next token of the input as a

byte

.

byte

**[nextByte](../../java/util/Scanner.html#nextByte%28int%29)**(int radix)

Scans the next token of the input as a

byte

.

double

**[nextDouble](../../java/util/Scanner.html#nextDouble%28%29)**()

Scans the next token of the input as a

double

.

float

**[nextFloat](../../java/util/Scanner.html#nextFloat%28%29)**()

Scans the next token of the input as a

float

.

int

**[nextInt](../../java/util/Scanner.html#nextInt%28%29)**()

Scans the next token of the input as an

int

.

int

**[nextInt](../../java/util/Scanner.html#nextInt%28int%29)**(int radix)

Scans the next token of the input as an

int

.

[String](../../java/lang/String.html "class in java.lang")

**[nextLine](../../java/util/Scanner.html#nextLine%28%29)**()

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

long

**[nextLong](../../java/util/Scanner.html#nextLong%28%29)**()

Scans the next token of the input as a

long

.

long

**[nextLong](../../java/util/Scanner.html#nextLong%28int%29)**(int radix)

Scans the next token of the input as a

long

.

short

**[nextShort](../../java/util/Scanner.html#nextShort%28%29)**()

Scans the next token of the input as a

short

.

short

**[nextShort](../../java/util/Scanner.html#nextShort%28int%29)**(int radix)

Scans the next token of the input as a

short

.

int

**[radix](../../java/util/Scanner.html#radix%28%29)**()

Returns this scanner's default radix.

void

**[remove](../../java/util/Scanner.html#remove%28%29)**()

The remove operation is not supported by this implementation ofIterator.

[Scanner](../../java/util/Scanner.html "class in java.util")

**[reset](../../java/util/Scanner.html#reset%28%29)**()

Resets this scanner.

[Scanner](../../java/util/Scanner.html "class in java.util")

**[skip](../../java/util/Scanner.html#skip%28java.util.regex.Pattern%29)**([Pattern](../../java/util/regex/Pattern.html "class in java.util.regex") pattern)

Skips input that matches the specified pattern, ignoring delimiters.

[Scanner](../../java/util/Scanner.html "class in java.util")

**[skip](../../java/util/Scanner.html#skip%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") pattern)

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

[String](../../java/lang/String.html "class in java.lang")

**[toString](../../java/util/Scanner.html#toString%28%29)**()

Returns the string representation of this Scanner.

[Scanner](../../java/util/Scanner.html "class in java.util")

**[useDelimiter](../../java/util/Scanner.html#useDelimiter%28java.util.regex.Pattern%29)**([Pattern](../../java/util/regex/Pattern.html "class in java.util.regex") pattern)

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

[Scanner](../../java/util/Scanner.html "class in java.util")

**[useDelimiter](../../java/util/Scanner.html#useDelimiter%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") pattern)

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

[Scanner](../../java/util/Scanner.html "class in java.util")

**[useLocale](../../java/util/Scanner.html#useLocale%28java.util.Locale%29)**([Locale](../../java/util/Locale.html "class in java.util") locale)

Sets this scanner's locale to the specified locale.

[Scanner](../../java/util/Scanner.html "class in java.util")

**[useRadix](../../java/util/Scanner.html#useRadix%28int%29)**(int radix)

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