sysproperties.java

来自「分页类,包括中文和英文及其他语言种类,便于二次开发及商业开发,」· Java 代码 · 共 52 行

JAVA
52 行
字号
package com.laoer.comm.util;

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

/**
 * <p>Title: 天乙软件工作室公共包</p>
 *
 * <p>Description: 天乙软件工作室公共包</p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: 天乙软件工作室[LAOER.COM/TIANYISOFT.NET]</p>
 *
 * @author 龚天乙(Laoer)
 * @version 1.0
 */
public class SysProperties {

  private Properties props = new Properties();

  public SysProperties() {
    InputStream infile;
    String filePath = System.getProperty("sysProperties", "/sysinfo.properties");
    try {
      if (filePath != null && !filePath.equals("/sysinfo.properties")) {
        infile = new FileInputStream(filePath);
      }
      else {
        infile = getClass().getResourceAsStream(filePath);
      }
      props.load(infile);
      infile.close();
    }
    catch (FileNotFoundException ex) {
    }
    catch (IOException ex) {
    }
  }

  public String getProperty(String key) {
    return this.props.getProperty(key);
  }

  public String getProperty(String key, String defaultValue) {
    return this.props.getProperty(key, defaultValue);
  }

}

⌨️ 快捷键说明

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