关于File类的toURL和toURI
以下是一段digester框架载入规则文件的代码,File的toURL方法已被废弃,看了一下JDK文档,感觉应该改为ruleFile.toURI().toURL(),因为时间关系来不及细细研究toURL和toURI方法的作用,先记下,等有空再看.
public void parse() throws Exception
{
File xmlFile = new File(getConfigPath() + data) ;
File ruleFile = new File(getConfigPath() + rule) ;
Digester digester = DigesterLoader.createDigester( ruleFile.toURI().toURL()/*ruleFile.toURL()*/);
digester.push(this) ;
digester.parse(xmlFile) ;
}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
