?? destination.java
字號:
package com.sunyard.dataanalyze;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.util.Iterator;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public class Destination {
private String ip;
private int port;
public Destination(){
URL xmlFileName = Destination.class.getResource("/destination.xml");
//String filePath = System.getProperty("user.dir")+"/destination.xml";
String filePath = xmlFileName.getPath();
SAXBuilder builder = new SAXBuilder();
Document doc;
try{
doc = builder.build(new File(filePath));
Element root = doc.getRootElement();
this.port = (new Integer(root.getChildText("port"))).intValue();
this.ip = root.getChildText("ip");
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(JDOMException e){
e.fillInStackTrace();
}catch(IOException e){
e.printStackTrace();
}
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -