📄 readconfig.java
字号:
import java.io.*;
public class ReadConfig
{
private String temp;
private File sourceFile;
private BufferedReader source;
private String AutoSrvIP="127.0.0.1";
private String BankSrvIP="127.0.0.1";
private String CompanyIP="127.0.0.1";
public String getAutoSrvIP()
{
return AutoSrvIP;
}
public String getBankSrvIP()
{
return BankSrvIP;
}
public String getCompanyIP()
{
return CompanyIP;
}
public ReadConfig()
{
try
{
source=new BufferedReader(new FileReader("..\\..\\config.txt"));
while((temp=source.readLine())!=null)
{
if (temp.substring(0,7).toUpperCase().equals("AUTOSRV"))
AutoSrvIP=new String(temp.substring(8,temp.length()));
if (temp.substring(0,7).toUpperCase().equals("BANKSRV"))
BankSrvIP=new String(temp.substring(8,temp.length()));
if (temp.substring(0,7).toUpperCase().equals("COMPANY"))
CompanyIP=new String(temp.substring(8,temp.length()));
}
source.close();
}
catch(IOException E)
{
System.out.println("Occur Read Config File I/O Error!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -