getClass().getClassLoader()和this.class.getClass...

InputStream   is   =   getClass().getClassLoader().getResourceAsStream("helloworld.properties");

InputStream   is   =   this.class.getClassLoader().getResourceAsStream("helloworld.properties");

两种写法都是为了将helloworld.properties配置文件转化成InputStream,写法比较高级。

普通点的方法是:InputStream in = new BufferedInputStream (new FileInputStream(filePath));

具体就不在研究了,参考地址:http://gloryme.iteye.com/blog/126895 ;

http://hi.baidu.com/langchao826/blog/item/83e685fa7956ddd5b58f3167.html

你可能感兴趣的:(getClass().getClassLoader()和this.class.getClass...)