All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jnt.io.NumericReader

java.lang.Object
   |
   +----jnt.io.NumericReader

public class NumericReader
extends Object
An easy interface to read numbers and strings from standard input.

Example use:

NumericReader R = new NumericReader( new FileReader("foo.dat"));
double x = R.readDouble();
int    i = R.readInt();
String s = R.readWord();
String l = R.readLine();
public variable:  R.Reader_ can be used in functions
or
NumericReader R = new NumericReader(new InputStreamReader(System.in));


Variable Index

 o Reader_

Constructor Index

 o NumericReader(Reader)

Method Index

 o readDouble()
read a floating point number from the console.
 o readInt()
read an integer from the console.
 o readLine()
read a line from a charater input stream.
 o readWord()
read a word from the console.

Variables

 o Reader_
 public Reader Reader_

Constructors

 o NumericReader
 public NumericReader(Reader in)

Methods

 o readLine
 public String readLine()
read a line from a charater input stream. The string is terminated by a newline

Returns:
the input line (without the newline)
 o readWord
 public String readWord() throws IOException
read a word from the console. The word is the first set of contiguous non-whitespace characters

Returns:
the 'word' entered
 o readInt
 public int readInt() throws IOException
read an integer from the console. The input is terminated by a newline

Parameters:
prompt - the prompt string to display
Returns:
the input value as an int
Throws: NumberFormatException
if bad input
 o readDouble
 public double readDouble() throws IOException
read a floating point number from the console. The input is terminated by a newline

Parameters:
prompt - the prompt string to display
Returns:
the input value as a double
Throws: NumberFormatException
if bad input

All Packages  Class Hierarchy  This Package  Previous  Next  Index