<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 {
    ?
    ?//根據(jù)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);
    ??????????? //調(diào)用 Hashtable 的方法 put。使用 getProperty 方法提供并行性。
    ??????????? //強(qiáng)制要求為屬性的鍵和值使用字符串。返回值是 Hashtable 調(diào)用 put 的結(jié)果。
    ??????????? 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 我心依舊 閱讀(2994) 評論(0)  編輯  收藏

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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲а∨天堂久久精品| 久久国产免费福利永久| 免费看片免费播放| 亚洲欧美日韩一区二区三区| 在线视频观看免费视频18| 亚洲男人天堂影院| 国产在线jyzzjyzz免费麻豆| 亚洲精品不卡视频| 成人超污免费网站在线看| 久久亚洲精品国产亚洲老地址| 成人午夜18免费看| 亚洲youwu永久无码精品| 国产a不卡片精品免费观看| 日韩在线一区二区三区免费视频| 亚洲综合小说久久另类区| 亚洲一区免费观看| 亚洲视频在线观看网站| 黄瓜视频影院在线观看免费| 国产午夜亚洲精品午夜鲁丝片| 波霸在线精品视频免费观看| 亚洲AV无码精品色午夜在线观看| 18女人水真多免费高清毛片| 亚洲乱码一二三四区乱码| 女人张开腿等男人桶免费视频| 未满十八私人高清免费影院| 亚洲乱码无码永久不卡在线| 最近2019中文字幕免费直播| 久久精品亚洲男人的天堂| 韩日电影在线播放免费版| 亚洲伊人久久大香线蕉苏妲己| 在线a级毛片免费视频| 亚洲第一se情网站| 国产亚洲精品观看91在线| 最近中文字幕高清免费中文字幕mv| 亚洲国产综合精品中文第一| 亚洲最大av无码网址| 日韩电影免费在线观看网址| 久久精品国产亚洲AV果冻传媒| 成年女人免费碰碰视频| 一级毛片免费不卡| 亚洲国产人成在线观看|