jar包文件读取

package com.sf.dtx5.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

/**
 * <p>Description: 系统属性定义配置类/p>
 * @version 1.0
 */
public class SystemPropertieUtils {
	
	public static String getJarFile()throws IOException {  //   /dtx5/com/sf/dtx5/util/res
        InputStream in=SystemPropertieUtils.class.getClass().getResourceAsStream("/version/version_beans.properties");//读jar包根目录下的idcheck-file.properties文件</span><span>  
        Reader f = new InputStreamReader(in);         
        BufferedReader fb = new BufferedReader(f);  
        StringBuffer sb = new StringBuffer("");  
        String s = "";  
        while((s = fb.readLine()) != null) {  
            sb = sb.append(s);  
        }  
        return sb.toString();  
    }
	
	 static String version =null;
	/**
	 *  String url= this.getClass().getClassLoader().getResourceAsStream("version_beans.xml")+"";
	 */
	private SystemPropertieUtils() {}
	/**
	 * 版本号//"V9.2";
	 * @throws IOException 
	 **/
/**	public static String versionId() throws IOException {
		String url=getJarFile();
		CDcwXmlFile xml = new CDcwXmlFile(url);
		boolean bRet = xml.selectSubItem("dtx5-version");//com.sf.dtx5.util.utildtx5_version
		if (bRet) {
			version = xml.readStr("version");
		}
		System.out.println(url);
		return version;
	}*/

}

  

posted @ 2017-12-27 16:47  杯子茶壶  阅读(76)  评论(0)    收藏  举报