码迷,mamicode.com
首页 > 其他好文 > 详细

读取属性文件内容

时间:2017-11-13 16:59:29      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:strong   inf   print   get   soc   文件   class   .class   string   

public class Client {
/**
* socket的连接参数属性文件
*/
private final String propFile = "/com/coruninfo/zs/tax/banksocket/handler/client.properties";//属性文件地址

Properties prop = new Properties();

InputStream input = Client.class.getResourceAsStream(propFile);//Client.class是当前类名
prop.load(input);
String IP = prop.getProperty("ip");
int PORT = Integer.parseInt(prop.getProperty("port"));
int TIMEOUT = Integer.parseInt(prop.getProperty("timeOut"));
System.out.println(IP + " , " + PORT + " , " + TIMEOUT);

}

读取属性文件内容

标签:strong   inf   print   get   soc   文件   class   .class   string   

原文地址:http://www.cnblogs.com/jzhxhs/p/7826526.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!