API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util. Scanner View Source
Author(s)
Since
1.5
Version
1.27, 06/28/06
Serial
Hierarchy
 Object
      Scanner
Implements
 Iterator
Subclasses
Description
publicfinal class Scanner
  A simple text scanner which can parse primitive types and strings using regular expressions.
See also:   
Constructors
public Scanner (File source) throws FileNotFoundException
  Constructs a new Scanner that produces values scanned from the specified file.
public Scanner (File source, String charsetName) throws FileNotFoundException
  Constructs a new Scanner that produces values scanned from the specified file.
public Scanner (InputStream source)
  Constructs a new Scanner that produces values scanned from the specified input stream.
public Scanner (InputStream source, String charsetName)
  Constructs a new Scanner that produces values scanned from the specified input stream.
public Scanner (Readable source)
  Constructs a new Scanner that produces values scanned from the specified source.
public Scanner (ReadableByteChannel source)
  Constructs a new Scanner that produces values scanned from the specified channel.
public Scanner (ReadableByteChannel source, String charsetName)
  Constructs a new Scanner that produces values scanned from the specified channel.
private Scanner (Readable source, Pattern pattern)
  Constructs a Scanner that returns values scanned from the specified source delimited by the specified pattern.
public Scanner (String source)
  Constructs a new Scanner that produces values scanned from the specified string.
Methods
Hide/Show inherited methods
public void close ()
  Closes this scanner.
public Pattern delimiter ()
  Returns the Pattern this Scanner is currently using to match delimiters.
public String findInLine (Pattern pattern)
  Attempts to find the next occurrence of the specified pattern ignoring delimiters.
public String findInLine (String pattern)
  Attempts to find the next occurrence of a pattern constructed from the specified string, ignoring delimiters.
public String findWithinHorizon (Pattern pattern, int horizon)
  Attempts to find the next occurrence of the specified pattern.
public String findWithinHorizon (String pattern, int horizon)
  Attempts to find the next occurrence of a pattern constructed from the specified string, ignoring delimiters.
public boolean hasNext () [Specified in Iterator]
  Returns true if this scanner has another token in its input.
public boolean hasNext (Pattern pattern)
  Returns true if the next complete token matches the specified pattern.
public boolean hasNext (String pattern)
  Returns true if the next token matches the pattern constructed from the specified string.
public boolean hasNextBigDecimal ()
  Returns true if the next token in this scanner's input can be interpreted as a BigDecimal using the Scanner.nextBigDecimal() method.
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 Scanner.nextBigInteger() method.
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 Scanner.nextBigInteger() method.
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".
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 Scanner.nextByte() method.
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 Scanner.nextByte() method.
public boolean hasNextDouble ()
  Returns true if the next token in this scanner's input can be interpreted as a double value using the Scanner.nextDouble() method.
public boolean hasNextFloat ()
  Returns true if the next token in this scanner's input can be interpreted as a float value using the Scanner.nextFloat() method.
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 Scanner.nextInt() method.
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 Scanner.nextInt() method.
public boolean hasNextLine ()
  Returns true if there is another line in the input of this scanner.
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 Scanner.nextLong() method.
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 Scanner.nextLong() method.
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 Scanner.nextShort() method.
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 Scanner.nextShort() method.
public IOException ioException ()
  Returns the IOException last thrown by this Scanner's underlying Readable.
public Locale locale ()
  Returns this scanner's locale.
public MatchResult match ()
  Returns the match result of the last scanning operation performed by this scanner.
public String next () [Specified in Iterator]
  Finds and returns the next complete token from this scanner.
public String next (Pattern pattern)
  Returns the next token if it matches the specified pattern.
public String next (String pattern)
  Returns the next token if it matches the pattern constructed from the specified string.
public BigDecimal nextBigDecimal ()
  Scans the next token of the input as a BigDecimal.
public BigInteger nextBigInteger ()
  Scans the next token of the input as a BigInteger.
public BigInteger nextBigInteger (int radix)
  Scans the next token of the input as a BigInteger.
public boolean nextBoolean ()
  Scans the next token of the input into a boolean value and returns that value.
public byte nextByte ()
  Scans the next token of the input as a byte.
public byte nextByte (int radix)
  Scans the next token of the input as a byte.
public double nextDouble ()
  Scans the next token of the input as a double.
public float nextFloat ()
  Scans the next token of the input as a float.
public int nextInt ()
  Scans the next token of the input as an int.
public int nextInt (int radix)
  Scans the next token of the input as an int.
public String nextLine ()
  Advances this scanner past the current line and returns the input that was skipped.
public long nextLong ()
  Scans the next token of the input as a long.
public long nextLong (int radix)
  Scans the next token of the input as a long.
public short nextShort ()
  Scans the next token of the input as a short.
public short nextShort (int radix)
  Scans the next token of the input as a short.
public int radix ()
  Returns this scanner's default radix.
public void remove () [Specified in Iterator]
  The remove operation is not supported by this implementation of Iterator.
public Scanner reset ()
  Resets this scanner.
public Scanner skip (Pattern pattern)
  Skips input that matches the specified pattern, ignoring delimiters.
public Scanner skip (String pattern)
  Skips input that matches a pattern constructed from the specified string.
public String toString ()
  Returns the string representation of this Scanner.
public Scanner useDelimiter (Pattern pattern)
  Sets this scanner's delimiting pattern to the specified pattern.
public Scanner useDelimiter (String pattern)
  Sets this scanner's delimiting pattern to a pattern constructed from the specified String.
public Scanner useLocale (Locale locale)
  Sets this scanner's locale to the specified locale.
public Scanner useRadix (int radix)
  Sets this scanner's default radix to the specified radix.
Fields
Hide/Show inherited fields
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar