CFEngine API

org.recommender.clients.console
Class Console

java.lang.Object
  |
  +--org.recommender.clients.console.Console

public class Console
extends java.lang.Object

An easy interface to read numbers and strings from standard input

Version:
1.0 12 Apr 2001
Author:
Sameer Kadam

Constructor Summary
Console()
           
 
Method Summary
static void printPrompt(java.lang.String prompt)
          print a prompt on the console but don't print a newline
static float readFloat(java.lang.String prompt)
          read a floating point number from the console.
static int readInt(java.lang.String prompt)
          read an integer from the console.
static java.lang.String readLine()
          read a string from the console.
static java.lang.String readLine(java.lang.String prompt)
          read a string from the console.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Console

public Console()
Method Detail

printPrompt

public static void printPrompt(java.lang.String prompt)
print a prompt on the console but don't print a newline

Parameters:
prompt - the prompt string to display

readLine

public static java.lang.String readLine()
read a string from the console. The string is terminated by a newline

Returns:
the input string (without the newline)

readLine

public static java.lang.String readLine(java.lang.String prompt)
read a string from the console. The string is terminated by a newline

Parameters:
prompt - the prompt string to display
Returns:
the input string (without the newline)

readInt

public static int readInt(java.lang.String prompt)
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:
java.lang.NumberFormatException - if bad input

readFloat

public static float readFloat(java.lang.String prompt)
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 float
Throws:
java.lang.NumberFormatException - if bad input

CFEngine API

Copyright © 2003 - Oregon State University www.orst.edu