Class Keyboard

java.lang.Object
  |
  +--Keyboard

public class Keyboard
extends java.lang.Object


Constructor Summary
Keyboard()
           
 
Method Summary
static boolean endOfLine()
          Check if there are no more tokens to read on the current input line.
static int getErrorCount()
          Get the number of errors
static boolean getPrintErrors()
          Returns a boolean indicating whether input errors are currently printed to standard output.
static boolean readBoolean()
          Returns a boolean read from standard input.
static char readChar()
          Returns a character read from standard input.
static double readDouble()
          Returns a double read from standard input.
static float readFloat()
          Returns a float read from standard input.
static int readInt()
          Returns an integer read from standard input.
static long readLong()
          Returns a long integer read from standard input.
static java.lang.String readString()
          Get a string from standard input.
static java.lang.String readWord()
          Returns a space-delimited substring (a word) read from standard input.
static void resetErrorCount()
          Resets the current error count to zero.
static void setPrintErrors(boolean flag)
          Sets a boolean indicating whether input errors are to be printed to standard output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Keyboard

public Keyboard()
Method Detail

getErrorCount

public static int getErrorCount()
Get the number of errors
Returns:
the current error count.

resetErrorCount

public static void resetErrorCount()
Resets the current error count to zero.

getPrintErrors

public static boolean getPrintErrors()
Returns a boolean indicating whether input errors are currently printed to standard output.
Returns:
true if errors are being printed to standard output

setPrintErrors

public static void setPrintErrors(boolean flag)
Sets a boolean indicating whether input errors are to be printed to standard output.
Parameters:
boolean - indicating whether or not to print errors

endOfLine

public static boolean endOfLine()
Check if there are no more tokens to read on the current input line.
Returns:
true if the end of the line has been reached

readString

public static java.lang.String readString()
Get a string from standard input.
Returns:
String read from standard input, or null on error

readWord

public static java.lang.String readWord()
Returns a space-delimited substring (a word) read from standard input.
Returns:
word read from standard input, or null on error

readBoolean

public static boolean readBoolean()
Returns a boolean read from standard input.
Returns:
boolean read from standard input or false on error

readChar

public static char readChar()
Returns a character read from standard input.
Returns:
character read from standard input or Character.MIN_VALUE on error

readInt

public static int readInt()
Returns an integer read from standard input.
Returns:
an int read from standard input or Integer.MIN_VALUE on error

readLong

public static long readLong()
Returns a long integer read from standard input.
Returns:
a long read from standard input or Long.MIN_VALUE on error

readFloat

public static float readFloat()
Returns a float read from standard input.
Returns:
a float read from standard input or Float.NaN on error

readDouble

public static double readDouble()
Returns a double read from standard input.
Returns:
a float read from standard input or Double.NaN on error