--
AndreGermanoRegert - 06 Jul 2005
Classe ClasseEntrada
/*
* Created on 05/07/2005
*/
package Uteis;
/**
* @author André Germano Regert
* Jader Wallauer
*/
public class Entrada {
public String inString(){
int aChar;
String s = "";
boolean finished = false;
while(!finished){
try {
aChar = System.in.read();
if (aChar < 0 || (char)aChar == '\n')
finished = true;
else if ((char)aChar != '\r')
s = s + (char)aChar; // Enter into string
} catch(java.io.IOException e) {
System.out.println("Input error");
finished = true;
}
}
return s;
}
public int inInt(){
boolean finished = false;
int retorno = 0;
while(!finished){
//inputFlush();
//printPrompt(prompt);
try {
retorno = Integer.valueOf(inString().trim()).intValue();
finished = true;
} catch(NumberFormatException e) {
System.out.println("Invalid input. Not an integer");
}
}
return retorno;
}
}