?? inputadress.java
字號:
package IOinput;
import java.io.*;
public class InputAdress {
private String baseurl,finalurl,command;
private Integer port;
public void inputbaseURL() throws IOException
{
System.out.print("請輸入一個URL:");
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
try {
baseurl=input.readLine();
} catch (IOException e) {
//e.printStackTrace();
throw new IOException("輸入URL時候IO發(fā)生錯誤。。。");
}
}
public String getbaseURL()
{
return baseurl;
}
public void inputfinalURL() throws IOException
{
System.out.print("請輸入一個URL文件路徑:");
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
try {
finalurl=input.readLine();
} catch (IOException e) {
// e.printStackTrace();
throw new IOException("輸入URL文件路徑的時候IO發(fā)生錯誤。。。");
}
}
public String getfinalURL()
{
return finalurl;
}
public void inputPort() throws IOException
{
Boolean isnumber=true;
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("錯誤原因:輸入的為非整數(shù),請重新輸入一個為整數(shù)的端口號:");
input=new BufferedReader(new InputStreamReader(System.in));
isnumber=true;
//e.printStackTrace();
}catch (IOException e) {
//e.printStackTrace();
throw new IOException("輸入端口的時候IO發(fā)生錯誤。。。。");
}
}
}
/**
* 返回端口號
* @return
*/
public Integer getPort()
{
return port;
}
public void inputCommand() throws IOException
{
String cmd=" ";
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("請輸入一個命令(直接按回車為系統(tǒng)的默認路徑):");
try {
cmd = br.readLine();
} catch (IOException e) {
//e.printStackTrace();
throw new IOException("錯誤原因:輸入命令的時候系統(tǒng)I/O發(fā)生錯誤。");
}
command="GET /"+cmd+" HTTP/1.0\r\n\r\n";
//command="GET /D:/Downloads/test1.txt HTTP/1.1\r\n\r\n";
}
public String getCommand()
{
return command;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -