一、读取

方法一:

try {
List<String> lines=IOUtils.readLines(FilterContext.class.getClassLoader().getResourceAsStream("filter-context.ini"),"UTF-8");

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

 

方法二:

File file = new File(Globals.class.getResource("/filter-context.ini").getFile());
if (file.exists()) {
try {
List<String> list = FileUtils.readLines(file,"UTF-8");

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

 

posted on 2016-02-29 17:58  何石-博客  阅读(165)  评论(0编辑  收藏  举报