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)