<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 70,comments - 408,trackbacks - 0

    package common;

    import java.io.BufferedInputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Enumeration;
    import java.util.Properties;

    public class ConfigInfo {
    ?
    ?//根據key讀取value
    ?public static String readValue(String filePath,String key) {
    ??Properties props = new Properties();
    ??????? try {
    ??????? ?InputStream in = new BufferedInputStream (new FileInputStream(filePath));
    ??????? ?props.load(in);
    ??????? ?String value = props.getProperty (key);
    ??????????? return value;
    ??????? } catch (Exception e) {
    ??????? ?Print.print("ConfigInfoError",e.toString());
    ??????? ?return null;
    ??????? }
    ?}
    ?
    ?//讀取properties的全部信息
    ??? public static void readProperties(String filePath) {
    ??? ?Properties props = new Properties();
    ??????? try {
    ??????? ?InputStream in = new BufferedInputStream (new FileInputStream(filePath));
    ??????? ?props.load(in);
    ??????????? Enumeration en = props.propertyNames();
    ??????????? ?while (en.hasMoreElements()) {
    ??????????? ??String key = (String) en.nextElement();
    ??????????????????? String Property = props.getProperty (key);
    ??????????????????? System.out.println(key+Property);
    ??????????????? }
    ??????? } catch (Exception e) {
    ??????? ?Print.print("ConfigInfoError",e.toString());
    ??????? }
    ??? }

    ??? //寫入properties信息
    ??? public static void writeProperties(String filePath,String parameterName,String parameterValue) {
    ??? ?Properties prop = new Properties();
    ??? ?try {
    ??? ??InputStream fis = new FileInputStream(filePath);
    ??????????? //從輸入流中讀取屬性列表(鍵和元素對)
    ??????????? prop.load(fis);
    ??????????? //調用 Hashtable 的方法 put。使用 getProperty 方法提供并行性。
    ??????????? //強制要求為屬性的鍵和值使用字符串。返回值是 Hashtable 調用 put 的結果。
    ??????????? OutputStream fos = new FileOutputStream(filePath);
    ??????????? prop.setProperty(parameterName, parameterValue);
    ??????????? //以適合使用 load 方法加載到 Properties 表中的格式,
    ??????????? //將此 Properties 表中的屬性列表(鍵和元素對)寫入輸出流
    ??????????? prop.store(fos, "Update '" + parameterName + "' value");
    ??????? } catch (IOException e) {
    ??????? ?Print.print("ConfigInfoError","Visit "+filePath+" for updating "+parameterName+" value error");
    ??????? }
    ??? }
    }

    posted on 2007-03-21 10:04 我心依舊 閱讀(2999) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲xxxxxx| 亚洲日韩乱码中文无码蜜桃臀| 亚洲日韩精品无码专区加勒比☆| 99免费观看视频| 亚洲色图在线播放| 99久久人妻精品免费一区| 亚洲黄色网址在线观看| 最近2019免费中文字幕视频三| 亚洲美女精品视频| 亚欧人成精品免费观看| 亚洲13又紧又嫩又水多| 女人18毛片水最多免费观看| 久久亚洲精品高潮综合色a片| 免费国产成人高清在线观看麻豆| 免费一级特黄特色大片| 国产亚洲人成网站在线观看| 日韩免费高清播放器| 亚洲高清视频在线播放| 国产精品成人免费福利| 亚洲国产精品自在自线观看| 亚洲电影日韩精品| 免费国产成人18在线观看| 91亚洲国产成人久久精品| 日韩免费无砖专区2020狼| 国产精品免费看久久久香蕉| 亚洲成a人片77777老司机| 久久久久亚洲AV成人网人人网站| 国产精品福利在线观看免费不卡| 亚洲一卡2卡三卡4卡有限公司| 美女视频黄a视频全免费| 九九精品国产亚洲AV日韩| 亚洲区小说区图片区QVOD| 亚洲成年人免费网站| 亚洲国产精品无码久久一线| 精品福利一区二区三区免费视频| 亚洲中文字幕无码av| 亚洲狠狠婷婷综合久久久久| 无码中文在线二区免费| 国产成人高清精品免费观看| 亚洲综合久久成人69| 亚洲第一成人影院|