?? commandinput.java
字號(hào):
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("請(qǐng)輸入一個(gè)URL:");
url=null;
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
try {
url=input.readLine();
} catch (IOException e) {
//e.printStackTrace();
throw new IOException("輸入U(xiǎn)RL時(shí)候IO發(fā)生錯(cuò)誤。。。");
}
return url;
}
/**public String getbaseURL()
{
return baseurl;
}*/
public String inputCommad() throws IOException
{
System.out.print("請(qǐng)輸入一個(gè)操作命令:");
commLine=null;
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
try {
commLine=input.readLine();
} catch (IOException e) {
// e.printStackTrace();
throw new IOException("輸入操作的時(shí)候IO發(fā)生錯(cuò)誤。。。");
}
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("請(qǐng)輸入一個(gè)端口號(hào):");
port=Integer.valueOf(input.readLine());
isnumber=false;
} catch (NumberFormatException e) {
System.err.print("錯(cuò)誤原因:輸入的為非整數(shù),請(qǐng)重新輸入一個(gè)為整數(shù)的端口號(hào):");
input=new BufferedReader(new InputStreamReader(System.in));
isnumber=true;
//e.printStackTrace();
}catch (IOException e) {
//e.printStackTrace();
throw new IOException("輸入端口的時(shí)候IO發(fā)生錯(cuò)誤。。。。");
}
}
return port;
}
/**
* 返回端口號(hào)
* @return
*/
/**public Integer getPort()
{
return port;
}*/
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -