/*====================================================================*/ /* D O N O T E D I T T H I S F I L E */ /*====================================================================*/ import java.io.*; /** * CS1312: IOHelper *
 * IOHelper - a utility for reading input from the keyboard
 *
 * Revisions:  3.0  January 19, 2000
 *                  Re-created class IOHelper
 *                  Completetly Trashed old versions
 *                  Removed backwards compatibility
 *
 * 
* @author CS1312 * @version Version 3.0, January 19, 2000 */ public class IOHelper { /*=================================================================*/ /* C O N S T A N T S */ /*=================================================================*/ /** * A Debug flag. */ public static final boolean bDEBUG = false; /*=================================================================*/ /* C O N S T R U C T O R */ /*=================================================================*/ /** * Declaring the default constructor private prevents anyone from * making an instance of this class. */ private IOHelper() { System.err.println("IOHelper is not meant to be instantiated"); } // end of default constructor, IOHelper() /*=================================================================*/ /* S T A T I C V A R I A B L E S */ /*=================================================================*/ /** * Used by the BufferedReader to retrieve input. *

* @see #bReader bReader */ protected static InputStreamReader iStreamReader = new InputStreamReader(System.in); /** * Retrieves input from the user using a wrapped InputStreamReader. *

* @see #iStreamReader iStreamReader */ protected static BufferedReader bReader = new BufferedReader(iStreamReader); /*=================================================================*/ /* S T A T I C M E T H O D S */ /*=================================================================*/ /** * Retrieves input from the user using a BufferedReader *

* @return a String entered by the User */ public static final String readLine() { String strReturn = ""; try { strReturn = bReader.readLine(); } // end of try catch (IOException ioe) { if (bDEBUG) { System.err.println("IOHelper: " + ioe.getMessage()); } // end of if } // end of catch(IOException) catch (NullPointerException npe) { /* This should NEVER happen */ System.err.println("IOHelper: " + npe.getMessage()); System.err.println("Please report this error to cs1312"); System.exit(1); } // end of catch(NullPointerException) return strReturn; } // end of static method, readLine() } // end of class IOHelper