type.util
Class Scanner

java.lang.Object
  extended by type.util.Scanner

public class Scanner
extends java.lang.Object

This class emmulates part of the functionality of its namesake in java.util in J2SE 5.

Version:
1.0 (Summer 2004)
Author:
H. Roumani, roumani@cs.yorku.ca

Constructor Summary
Scanner(java.io.InputStream source)
          Constructs a scanner instance connected to the passed source.
 
Method Summary
 java.lang.String next()
          Finds and returns the next complete token from this scanner.
 boolean nextBoolean()
          Scans the next token of the input as a boolean.
 byte nextByte()
          Scans the next token of the input as a byte.
 char nextChar()
          Scans the next token of the input as a char.
 double nextDouble()
          Scans the next token of the input as a double.
 float nextFloat()
          Scans the next token of the input as a float.
 int nextInt()
          Scans the next token of the input as a int.
 java.lang.String nextLine()
          Advances this scanner past the current line and returns the input that was skipped.
 long nextLong()
          Scans the next token of the input as a long.
 short nextShort()
          Scans the next token of the input as a short.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scanner

public Scanner(java.io.InputStream source)
Constructs a scanner instance connected to the passed source. For console input, pass System.in, and for reading from a file, pass a file input stream. The tokens to be read are assumed to be whitespace-delimited.

Method Detail

nextByte

public byte nextByte()
Scans the next token of the input as a byte.


nextShort

public short nextShort()
Scans the next token of the input as a short.


nextChar

public char nextChar()
Scans the next token of the input as a char.


nextInt

public int nextInt()
Scans the next token of the input as a int.


nextLong

public long nextLong()
Scans the next token of the input as a long.


nextFloat

public float nextFloat()
Scans the next token of the input as a float.


nextDouble

public double nextDouble()
Scans the next token of the input as a double.


nextBoolean

public boolean nextBoolean()
Scans the next token of the input as a boolean.


nextLine

public java.lang.String nextLine()
Advances this scanner past the current line and returns the input that was skipped.


next

public java.lang.String next()
Finds and returns the next complete token from this scanner.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Java by Abstraction: A Client-View Approach