zoukankan      html  css  js  c++  java
  • java properties

    java properties

    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import java.util.Properties;

    public class PropertiesTest {
        public static void main(String[] args) throws Exception {
            // from file "myProperties.txt"
            Properties p = new Properties();
            try{
                FileInputStream propFile = new FileInputStream("myProperties.txt");
                p.load(propFile);
                p.list(System.out);
            } catch (FileNotFoundException e)  {
            }
           
            // Write properties file.
            try {
                p.setProperty("lastdir", "c:\\tmp");
                p.store(new FileOutputStream("myProperties.txt"), null);
            } catch (IOException e) {
            }
        }
    }


    String propFile = this.getServletContext().getRealPath("/") + "/WEB-INF/classes/security.properties";
    Properties prop = new Properties();
    try{ prop.load(new FileInputStream(propFile)); }
    catch(IOException ioe){ throw (new SecurityException(("Failed to initialize properties with default properties file " + propFile))); }
    SecureStream ss = new SecureStream (in, out, prop);
  • 相关阅读:
    docker内存和cpu调试
    docker网络之overlay
    docker网络之bridge
    kubernete的证书总结
    docker网络之macvlan
    理解kubernetes环境的iptables
    前端面试题和答案
    软件项目技术点(25)——提升性能之检测绘制范围
    setTimeout的实现原理以及setTimeout(0)的使用场景
    HTML5新特性之WebSocket
  • 原文地址:https://www.cnblogs.com/kentyshang/p/807394.html
Copyright © 2011-2022 走看看