<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)航:
     
    主站蜘蛛池模板: 久久精品国产亚洲AV电影网| 亚洲日韩精品无码专区网址| 亚洲电影唐人社一区二区| 成人性做爰aaa片免费看| 亚洲一区爱区精品无码| 国产免费黄色无码视频| 国产精品亚洲二区在线观看 | 亚洲国产成人无码AV在线| 毛片A级毛片免费播放| 亚洲人成电影院在线观看| 91免费播放人人爽人人快乐| 亚洲不卡AV影片在线播放| 特级毛片aaaa级毛片免费| 四虎影在线永久免费四虎地址8848aa| 亚洲AV日韩AV一区二区三曲 | 中文字幕在线成人免费看| 怡红院亚洲怡红院首页| a毛片全部播放免费视频完整18| 久久国产亚洲精品麻豆| 7m凹凸精品分类大全免费| 亚洲国产视频网站| 成年女人看片免费视频播放器| 亚洲av无码有乱码在线观看| 亚洲国产专区一区| 久久国产精品成人免费| 亚洲国产精品成人精品小说| 搡女人真爽免费视频大全| 美国免费高清一级毛片| 亚洲精品无码久久久影院相关影片| 午夜视频在线免费观看| 亚洲色偷偷色噜噜狠狠99网| 亚洲国产综合无码一区二区二三区| 色www永久免费网站| 亚洲第一页中文字幕| 国产美女被遭强高潮免费网站| 一级毛片在线完整免费观看| 亚洲国产精品热久久| 免费看片A级毛片免费看| 亚洲天堂免费在线视频| 亚洲国产精品久久久久秋霞影院| 日本免费人成黄页在线观看视频|