⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileutil.java

📁 银行项目为后台socket通信写的程序
💻 JAVA
字号:
/****************************************************************************
 * Package		: com.ecSolutions.ecAppServer.util
 * File			: FileUtil.java
 * Create Date  : 2007-7-24
 * Author		: Steven Chen
 * 
 * Copyright(C) 2006 ecSolutions(shanghai) Co.,Limited.All Rights Reserved.
 *			
 ***************************************************************************/
package com.ecSolutions.ecAppServer.util;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

public class FileUtil {
	private static Logger log = Logger.getLogger("FileUtil");

	public static Properties loadProperties(String filename) throws IOException {
    	Properties props = new Properties();
    	log.debug("-----------"  + System.getProperty("user.dir"));
    	String path = System.getProperty("ConfigPath");
    	log.debug("read Config Path is :" + path);
    	if (path ==null || path.trim().equals("")){
    		path = System.getProperty("user.dir") + System.getProperty("file.separator") + "config";
    	}
    	log.debug("Config Path in Using is :" + path);
    	
    	log.debug("read file from:" + path + System.getProperty("file.separator") + filename);
    	InputStream stream = null;//this.getClass().getResourceAsStream( path + System.getProperty("file.separator") +filename);
    	stream = new FileInputStream(path + System.getProperty("file.separator") + filename);
    	//InputStream stream = Configuration.class.getResourceAsStream("/" +CONFIG_FILE_NAME);
    	if ( stream != null ){
			try {
				props.load( stream );
			} finally{
				try {
					stream.close();
				}catch (IOException ioe) {}
			}	
    	}else{
    		throw new IOException("could not load the file: " + filename);
    	}
    	return props;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -