首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Java 访问各种资料

2012-12-28 
Java 访问各种文件?1、读取.properties 文件??? ? ? ?Properties config new Properties()??? ? ? ?Inpu

Java 访问各种文件

?

1、读取.properties 文件

?

?? ? ? ?Properties config = new Properties();

?

?? ? ? ?InputStream input = null;

?

?? ? ? input = new FileInputStream(path); ? ? ? ? ? ?

?

?? ? ? config.load(input); ? ? ? ? ??

?

?

?

?

?

2、读取Spring配置文件?

?

ApplicationContext ac = new FileSystemXmlApplicationContext(springPath);

?

?

?

3、dom4j读取xml文件

?

?SAXReader saxReader = new SAXReader();?

?

??Document document = saxReader.read(inputXml);

?

?

4、dom4j解析xml字符串

??Document doc = DocumentHelper.parseText(String text)

热点排行