python的數(shù)據(jù)類型有哪些 ResourceBundle有什么用?
ResourceBundle有什么用?通常用于讀取屬性文件,如私有靜態(tài)資源bundlerb=ResourceBundle.getBundle包(" 測(cè)試.屬性)然后通過(guò)rb.getString命令(“
ResourceBundle有什么用?
通常用于讀取屬性文件,如私有靜態(tài)資源bundlerb=ResourceBundle.getBundle包(" 測(cè)試.屬性)然后通過(guò)rb.getString命令(“AA”)測(cè)試.屬性文件中AA屬性的值。
ResourceBundle和Properties類的區(qū)別?
一般來(lái)說(shuō),resourcebundle類通常是用于不同語(yǔ)言的屬性文件。
如果應(yīng)用程序中的屬性文件只是一些配置,則它不適用于多語(yǔ)言用途。然后使用properties類。
通??梢詫⑦@些屬性文件放在jar文件中。然后,通過(guò)調(diào)用類的getresourceasstream方法獲得屬性文件的stream對(duì)象,然后由properties類的load方法加載。
ResourceBundle.getBundle方法中的文件路徑的分隔符為什么要用?
資源包rb=ResourceBundle.getBundle包(“property file path”)//從枚舉中取出文件的鍵<string>=rb.getKeys鍵()//存儲(chǔ)屬性文件的鍵值對(duì),HashMap<string,string> HM=new HashMap<string,string>()//根據(jù)鍵(埃姆哈斯莫爾元素()){字符串鍵=em.nextElement公司()字符串值=rb.getString命令(鍵)嗯,普特(key,value)}//屬性文件的內(nèi)容都在映射中