All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.holmos.cache.utils.CacheBaseUtils Maven / Gradle / Ivy

There is a newer version: 1.0.2u10
Show newest version
package com.holmos.cache.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;


/**
 * Watsen 平台缓存系统的基础工具类
 * 
 * @author 吴银龙([email protected])
 * 
 * */
public class CacheBaseUtils {
	/**
	 * 从指定的绝对路径获取xml文档对象
	 * @param xmlFilePath xml文档绝对路径
	 * */
	public static Document getDocument(String xmlFilePath){
		SAXReader reader = new SAXReader();
		Document document=null;
		try {
			document=reader.read(new InputStreamReader(new FileInputStream(new File(xmlFilePath)), "UTF-8"));
		} catch (DocumentException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}return document;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy