<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());
    ??????? }
    ??? }

    ??? //寫(xiě)入properties信息
    ??? public static void writeProperties(String filePath,String parameterName,String parameterValue) {
    ??? ?Properties prop = new Properties();
    ??? ?try {
    ??? ??InputStream fis = new FileInputStream(filePath);
    ??????????? //從輸入流中讀取屬性列表(鍵和元素對(duì))
    ??????????? 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 表中的屬性列表(鍵和元素對(duì))寫(xiě)入輸出流
    ??????????? 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 我心依舊 閱讀(2993) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲av无码成人精品区| 国产亚洲精品自在线观看| 国产青草亚洲香蕉精品久久| 亚洲毛片网址在线观看中文字幕| 香蕉免费在线视频| 久久精品亚洲AV久久久无码| 免费永久在线观看黄网站| 久久久久久久99精品免费观看| 亚洲伊人久久大香线焦| 亚洲视频在线一区二区| 免费专区丝袜脚调教视频| 免费福利在线观看| 亚洲精品视频久久| 亚洲XX00视频| 免费AA片少妇人AA片直播| 国产高潮流白浆喷水免费A片 | 亚洲欧洲在线播放| 国产成人高清亚洲| 好爽又高潮了毛片免费下载| 国产一级片免费看| 美女露隐私全部免费直播| 久久精品国产亚洲AV麻豆网站| 免费v片在线观看无遮挡| 69视频免费观看l| 成年网在线观看免费观看网址| 亚洲免费福利视频| 亚洲精品亚洲人成在线观看| 午夜视频免费成人| 91青青青国产在观免费影视| 日韩久久无码免费毛片软件| jlzzjlzz亚洲jzjzjz| 亚洲av无码成h人动漫无遮挡 | 丰满亚洲大尺度无码无码专线| 亚洲AV色香蕉一区二区| 免费看国产精品麻豆| 很黄很黄的网站免费的| 男人都懂www深夜免费网站| 免费人成网上在线观看| 亚洲精品无码专区久久| 亚洲天堂中文字幕在线观看| 亚洲妇熟XXXX妇色黄|