資源簡介
代碼片段和文件信息
package?com.mingrisoft;
import?java.io.FileOutputStream;
import?java.util.Properties;
public?class?SaveProperties?{
????/**
?????*?@param?args
?????*/
????public?void?saveProperties(String?key?String?value)?{
????????Properties?properties?=?new?Properties();?//?定義Properties對象
????????properties.setProperty(key?value);?//?設置屬性文件值
????????try?{
????????????FileOutputStream?out?=?new?FileOutputStream(“D://message.properties“);//?創建輸出流對象
????????????properties.store(out?“test“);?//?將信息通過流寫入到屬性文件
????????????out.close();?//?關閉流
????????}?catch?(Exception?e)?{
????????????e.printStackTrace();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????301??2011-05-23?19:43??.classpath
?????文件?????????379??2011-05-23?19:43??.project
?????目錄???????????0??2012-02-22?14:42??.settings\
?????文件?????????629??2011-05-23?19:43??.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2012-02-22?14:42??src\
?????目錄???????????0??2012-02-22?14:42??src\com\
?????目錄???????????0??2012-02-22?14:42??src\com\mingrisoft\
?????文件?????????678??2011-05-23?19:43??src\com\mingrisoft\SaveProperties.java
?????文件????????3120??2011-05-23?19:43??src\com\mingrisoft\SavePropertiesfr
評論
共有 條評論