propertyutil.java

来自「struts+spring+hibernate自创框架」· Java 代码 · 共 49 行

JAVA
49
字号
package com.pegasus.framework.util;

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

public class PropertyUtil {
	
	public static void generatePropertyJava(String propFileName) {
		InputStream in = null;
		try {
			in = new FileInputStream(propFileName);
			Properties prop = new Properties();
			prop.load(in);
			Enumeration en = prop.keys();
			while(en.hasMoreElements()) {
				String key = (String)en.nextElement();
				if(key.indexOf("error.uncatched.exception") != -1) {
					String value = key;
					key = key.replace(".","_");
					
					key = key.toUpperCase();
					String result = "";
					result = "public static final String " + key + " = \"" + value + "\";";
					System.out.println(result);
				}
				
			}
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	
	
	
	
	
	
	
	public static void main(String args[]) {
		generatePropertyJava("F:/comet/WORK/NS/site/project/framework/src/properties/Resources.properties");
	}
}

⌨️ 快捷键说明

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