java.applet

java.awt

java.awt.color

java.awt.datatransfer

java.awt.dnd

java.awt.event

java.awt.font

java.awt.geom

java.awt.im

java.awt.im.spi

java.awt.image

java.awt.image.renderable

java.awt.print

java.beans

java.beans.beancontext

java.io

java.lang

java.lang.annotation

java.lang.instrument

java.lang.management

java.lang.ref

java.lang.reflect

java.math

java.net

java.nio

java.nio.channels

java.nio.channels.spi

java.nio.charset

java.nio.charset.spi

java.rmi

java.rmi.activation

java.rmi.dgc

java.rmi.registry

java.rmi.server

java.security

java.security.acl

java.security.cert

java.security.interfaces

java.security.spec

java.sql

java.text

java.util

java.util.concurrent

java.util.concurrent.atomic

java.util.concurrent.locks

java.util.jar

java.util.logging

java.util.prefs

java.util.regex

java.util.zip

javax.accessibility

javax.activity

javax.crypto

javax.crypto.interfaces

javax.crypto.spec

javax.imageio

javax.imageio.event

javax.imageio.metadata

javax.imageio.plugins.bmp

javax.imageio.plugins.jpeg

javax.imageio.spi

javax.imageio.stream

javax.management

javax.management.loading

javax.management.modelmbean

javax.management.monitor

javax.management.openmbean

javax.management.relation

javax.management.remote

javax.management.remote.rmi

javax.management.timer

javax.naming

javax.naming.directory

javax.naming.event

javax.naming.ldap

javax.naming.spi

javax.net

javax.net.ssl

javax.print

javax.print.attribute

javax.print.attribute.standard

javax.print.event

javax.rmi

javax.rmi.CORBA

javax.rmi.ssl

javax.security.auth

javax.security.auth.callback

javax.security.auth.kerberos

javax.security.auth.login

javax.security.auth.spi

javax.security.auth.x500

javax.security.cert

javax.security.sasl

javax.sound.midi

javax.sound.midi.spi

javax.sound.sampled

javax.sound.sampled.spi

javax.sql

javax.sql.rowset

javax.sql.rowset.serial

javax.sql.rowset.spi

javax.swing

javax.swing.border

javax.swing.colorchooser

javax.swing.event

javax.swing.filechooser

javax.swing.plaf

javax.swing.plaf.basic

javax.swing.plaf.metal

javax.swing.plaf.multi

javax.swing.plaf.synth

javax.swing.table

javax.swing.text

javax.swing.text

javax.swing.text.parser

javax.swing.text.rtf

javax.swing.tree

javax.swing.undo

javax.transaction

javax.transaction.xa

javax.xml

javax.xml.datatype

javax.xml.namespace

javax.xml.parsers

javax.xml.transform

javax.xml.transform.dom

javax.xml.transform.sax

javax.xml.transform.stream

javax.xml.validation

javax.xml.xpath

org.ietf.jgss

org.omg.CORBA

org.omg.CORBA_2_3

org.omg.CORBA_2_3.portable

org.omg.CORBA.DynAnyPackage

org.omg.CORBA.ORBPackage

org.omg.CORBA.portable

org.omg.CORBA.TypeCodePackage

org.omg.CosNaming

org.omg.CosNaming.NamingContextExtPackage

org.omg.CosNaming.NamingContextPackage

org.omg.Dynamic

org.omg.DynamicAny

org.omg.DynamicAny.DynAnyFactoryPackage

org.omg.DynamicAny.DynAnyPackage

org.omg.IOP

org.omg.IOP.CodecFactoryPackage

org.omg.IOP.CodecPackage

org.omg.Messaging

org.omg.PortableInterceptor

org.omg.PortableInterceptor.ORBInitInfoPackage

org.omg.PortableServer

org.omg.PortableServer.CurrentPackage

org.omg.PortableServer.POAManagerPackage

org.omg.PortableServer.POAPackage

org.omg.PortableServer.portable

org.omg.PortableServer.ServantLocatorPackage

org.omg.SendingContext

org.omg.stub.java.rmi

org.w3c.dom

org.w3c.dom.bootstrap

org.w3c.dom.events

org.w3c.dom.ls

org.xml.sax

org.xml.sax.ext

org.xml.sax.helpers

allclasses-frame

allclasses-noframe

constant-values

deprecated-list

help-doc

JavaTM 2 Platform
Standard Ed. 5.0

java.util
类 PropertyResourceBundle

java.lang.Object
  继承者 java.util.ResourceBundle
      继承者 java.util.PropertyResourceBundle

public class PropertyResourceBundle
extends ResourceBundle

PropertyResourceBundleResourceBundle 的一个具体子类,它使用属性文件中的静态字符串集合来管理语言环境资源。有关资源包的更多信息,请参阅 ResourceBundle。有关属性文件的更多信息,特别是有关字符编码的信息,请参阅 Properties

与其他资源包类型不同,不能为 PropertyResourceBundle 创建子类。相反,要提供含有资源数据的属性文件。ResourceBundle.getBundle 将自动查找合适的属性文件并创建引用该文件的 PropertyResourceBundle。有关搜索和实例化策略的完整描述,请参阅 ResourceBundle.getBundle

下面的示例显示了资源包系列中具有基本名称 "MyResources" 的成员。文本定义了包 "MyResources_de",这是该包系列中的德语成员。该成员基于 PropertyResourceBundle,因此文本就是文件 "MyResources_de.properties" 的内容(一个相关的 示例显示了如何将包添加到该系列中,该系列作为 ListResourceBundle 的子类来实现)。本示例的键形式为 "s1" 等等。实际的键完全取决于您的选择,只要它们与在程序中使用的、用于从包中检索对象的键相同即可。键是区分大小写的。

 # MessageFormat pattern
 s1=Die Platte \"{1}\" enthält {0}.

 # location of {0} in pattern
 s2=1

 # sample disk name
 s3=Meine Platte

 # first ChoiceFormat choice
 s4=keine Dateien

 # second ChoiceFormat choice
 s5=eine Datei

 # third ChoiceFormat choice
 s6={0,number} Dateien

 # sample date
 s7=3. März 1996
 

从以下版本开始:
JDK1.1
另请参见:
ResourceBundle, ListResourceBundle, Properties

字段摘要
 
从类 java.util.ResourceBundle 继承的字段
parent
 
构造方法摘要
PropertyResourceBundle(InputStream stream)
          创建属性资源包。
 
方法摘要
 Enumeration<String> getKeys()
          ResourceBundle.getKeys 的实现。
 Object handleGetObject(String key)
          从此资源包中获取给定键的对象。
 
从类 java.util.ResourceBundle 继承的方法
getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

PropertyResourceBundle

public PropertyResourceBundle(InputStream stream)
                       throws IOException
创建属性资源包。

参数:
stream - 所读取的属性文件。
抛出:
IOException
方法详细信息

handleGetObject

public Object handleGetObject(String key)
从类 ResourceBundle 复制的描述
从此资源包中获取给定键的对象。如果此资源包未包含给定键的对象,则返回 null。

指定者:
ResourceBundle 中的 handleGetObject
参数:
key - 所需对象的键。
返回:
给定键的对象,或者为 null。

getKeys

public Enumeration<String> getKeys()
ResourceBundle.getKeys 的实现。

指定者:
ResourceBundle 中的 getKeys

JavaTM 2 Platform
Standard Ed. 5.0

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策