📄 commandinput.java
字号:
package agendaClient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CommandInput{
private String url,commLine;
private Integer port;
public String inputURL() throws IOException
{
System.out.print("请输入一个URL:");
url=null;
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
try {
url=input.readLine();
} catch (IOException e) {
//e.printStackTrace();
throw new IOException("输入URL时候IO发生错误。。。");
}
return url;
}
/**public String getbaseURL()
{
return baseurl;
}*/
public String inputCommad() throws IOException
{
System.out.print("请输入一个操作命令:");
commLine=null;
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
try {
commLine=input.readLine();
} catch (IOException e) {
// e.printStackTrace();
throw new IOException("输入操作的时候IO发生错误。。。");
}
return commLine;
}
/**public String getCommand()
{
return commLine;
}*/
public int inputPort() throws IOException
{
Boolean isnumber=true;
port=0;
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
while(isnumber)
{
try {
System.out.print("请输入一个端口号:");
port=Integer.valueOf(input.readLine());
isnumber=false;
} catch (NumberFormatException e) {
System.err.print("错误原因:输入的为非整数,请重新输入一个为整数的端口号:");
input=new BufferedReader(new InputStreamReader(System.in));
isnumber=true;
//e.printStackTrace();
}catch (IOException e) {
//e.printStackTrace();
throw new IOException("输入端口的时候IO发生错误。。。。");
}
}
return port;
}
/**
* 返回端口号
* @return
*/
/**public Integer getPort()
{
return port;
}*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -