import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Input {
/**
* 实现获取用户从控制台的标准I/O输入,并对非法输入进行提示
*
* @author sakyone
* @throws IOException
*/
private String input;
public String getInput() throws IOException {
String input;
System.out.println("----------是否删除原数据库表数据?是/否(Y/N)-----------");
BufferedReader stdin;
stdin = new BufferedReader(new InputStreamReader(System.in));
input = stdin.readLine();
boolean wrong = (input == null || input.trim().equals("") || (!input
.trim().toLowerCase().equals("y") && !input.trim()
.toLowerCase().equals("n")));
while (wrong) {
System.out.println("------你输入的格式必须是: Y/N --------");
stdin = new BufferedReader(new InputStreamReader(System.in));
input = stdin.readLine();
wrong = (input == null || input.trim().equals("") || (!input.trim()
.toLowerCase().equals("y") && !input.trim().toLowerCase()
.equals("n")));
}
System.err.println("-------你输入的是: " + input + "---------");
return this.input = input;
}
}