国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
J2SE API讀取Properties文件六種方法

J2SE API讀取Properties文件六種方法

2006-06-29 09:47:59 來源: JR  網(wǎng)友評論 0 進入論壇

使用J2SEAPI讀取Properties文件的六種方法

1。使用java.util.Properties類的load()方法

示例:InputStreamin=lnewBufferedInputStream(newFileInputStream(name));

Propertiesp=newProperties();

p.load(in);

2。使用java.util.ResourceBundle類的getBundle()方法

示例:ResourceBundlerb=ResourceBundle.getBundle(name,Locale.getDefault());

3。使用java.util.PropertyResourceBundle類的構(gòu)造函數(shù)

示例:InputStreamin=newBufferedInputStream(newFileInputStream(name));

ResourceBundlerb=newPropertyResourceBundle(in);

4。使用class變量的getResourceAsStream()方法

示例:InputStreamin=JProperties.class.getResourceAsStream(name);

Propertiesp=newProperties();

p.load(in);

5。使用class.getClassLoader()所得到的java.lang.ClassLoader的getResourceAsStream()方法

示例:InputStreamin=JProperties.class.getClassLoader().getResourceAsStream(name);

Propertiesp=newProperties();

p.load(in);

6。使用java.lang.ClassLoader類的getSystemResourceAsStream()靜態(tài)方法

示例:InputStreamin=ClassLoader.getSystemResourceAsStream(name);

Propertiesp=newProperties();

p.load(in);

補充

Servlet中可以使用javax.servlet.ServletContext的getResourceAsStream()方法

示例:InputStreamin=context.getResourceAsStream(path);

Propertiesp=newProperties();

p.load(in);

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
java中Class.getResource用法
Java讀取Properties文件的六種方法
osworkflow源碼分析(一)
深入jar包:從jar包中讀取資源文件
java讀配置文件(xml、property)的簡單例子
你對Java類加載器(自定義類加載器)有了解嗎?
更多類似文章 >>
生活服務(wù)
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服