# PropertyResourceBundle

public class **PropertyResourceBundle** extends [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html)  
`PropertyResourceBundle` is a concrete subclass of
`ResourceBundle` that manages resources for a locale
using a set of static strings from a property file. See
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html` for more information about resource
bundles.


Unlike other types of resource bundle, you don't subclass
`PropertyResourceBundle`. Instead, you supply properties
files containing the resource data. `ResourceBundle.getBundle`
will automatically look for the appropriate properties file and create a
`PropertyResourceBundle` that refers to it. See
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBundle(java.lang.String,%20java.util.Locale,%20java.lang.ClassLoader)`
for a complete description of the search and instantiation strategy.


The following example shows a member of a resource
bundle family with the base name "MyResources".
The text defines the bundle "MyResources_de",
the German member of the bundle family.
This member is based on `PropertyResourceBundle`, and the text
therefore is the content of the file "MyResources_de.properties"
(a related [example](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ListResourceBundle#sample) shows
how you can add bundles to this family that are implemented as subclasses
of `ListResourceBundle`).
The keys in this example are of the form "s1" etc. The actual
keys are entirely up to your choice, so long as they are the same as
the keys you use in your program to retrieve the objects from the bundle.
Keys are case-sensitive.
>
> ```
>  # 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
>  
> ```


The implementation of a `PropertyResourceBundle` subclass must be
thread-safe if it's simultaneously used by multiple threads. The default
implementations of the non-abstract methods in this class are thread-safe.


**Note:** PropertyResourceBundle can be constructed either
from an InputStream or a Reader, which represents a property file.
Constructing a PropertyResourceBundle instance from an InputStream requires
that the input stream be encoded in ISO-8859-1. In that case, characters
that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes
as defined in section 3.3 of
The Java™ Language Specification
whereas the other constructor which takes a Reader does not have that limitation.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ListResourceBundle.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Properties.html`

### Inherited Field Summary

From class [java.util.ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html)

|---|---|---|
| protected [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [parent](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#parent) | The parent bundle of this bundle. |

### Public Constructor Summary

|---|---|
|   | [PropertyResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PropertyResourceBundle.html#PropertyResourceBundle(java.io.InputStream))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) stream) Creates a property resource bundle from an `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html`. |
|   | [PropertyResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PropertyResourceBundle.html#PropertyResourceBundle(java.io.Reader))([Reader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Reader.html) reader) Creates a property resource bundle from a `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Reader.html`. |

### Public Method Summary

|---|---|
| [Enumeration](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Enumeration.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [getKeys](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PropertyResourceBundle.html#getKeys())() Returns an `Enumeration` of the keys contained in this `ResourceBundle` and its parent bundles. |
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [handleGetObject](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PropertyResourceBundle.html#handleGetObject(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) key) Gets an object for the given key from this resource bundle. |

### Protected Method Summary

|---|---|
| [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [handleKeySet](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PropertyResourceBundle.html#handleKeySet())() Returns a `Set` of the keys contained *only* in this `ResourceBundle`. |

### Inherited Method Summary

From class [java.util.ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html)

|---|---|
| final static void | [clearCache](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#clearCache(java.lang.ClassLoader))([ClassLoader](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/ClassLoader.html) loader) Removes all resource bundles from the cache that have been loaded using the given class loader. |
| final static void | [clearCache](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#clearCache())() Removes all resource bundles from the cache that have been loaded using the caller's class loader. |
| boolean | [containsKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#containsKey(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) key) Determines whether the given `key` is contained in this `ResourceBundle` or its parent bundles. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getBaseBundleName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBaseBundleName())() Returns the base name of this bundle, if known, or `null` if unknown. |
| final static [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [getBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBundle(java.lang.String,%20java.util.Locale,%20java.util.ResourceBundle.Control))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) baseName, [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) targetLocale, [ResourceBundle.Control](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.Control.html) control) Returns a resource bundle using the specified base name, target locale and control, and the caller's class loader. |
| final static [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [getBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBundle(java.lang.String,%20java.util.Locale))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) baseName, [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Gets a resource bundle using the specified base name and locale, and the caller's class loader. |
| final static [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [getBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBundle(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) baseName) Gets a resource bundle using the specified base name, the default locale, and the caller's class loader. |
| static [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [getBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBundle(java.lang.String,%20java.util.Locale,%20java.lang.ClassLoader,%20java.util.ResourceBundle.Control))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) baseName, [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) targetLocale, [ClassLoader](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/ClassLoader.html) loader, [ResourceBundle.Control](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.Control.html) control) Returns a resource bundle using the specified base name, target locale, class loader and control. |
| static [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [getBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBundle(java.lang.String,%20java.util.Locale,%20java.lang.ClassLoader))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) baseName, [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale, [ClassLoader](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/ClassLoader.html) loader) Gets a resource bundle using the specified base name, locale, and class loader. |
| final static [ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) | [getBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getBundle(java.lang.String,%20java.util.ResourceBundle.Control))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) baseName, [ResourceBundle.Control](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.Control.html) control) Returns a resource bundle using the specified base name, the default locale and the specified control. |
| abstract [Enumeration](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Enumeration.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [getKeys](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getKeys())() Returns an enumeration of the keys. |
| [Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) | [getLocale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getLocale())() Returns the locale of this resource bundle. |
| final [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [getObject](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getObject(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) key) Gets an object for the given key from this resource bundle or one of its parents. |
| final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getString](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getString(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) key) Gets a string for the given key from this resource bundle or one of its parents. |
| final [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getStringArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#getStringArray(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) key) Gets a string array for the given key from this resource bundle or one of its parents. |
| abstract [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [handleGetObject](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#handleGetObject(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) key) Gets an object for the given key from this resource bundle. |
| [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [handleKeySet](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#handleKeySet())() Returns a `Set` of the keys contained *only* in this `ResourceBundle`. |
| [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [keySet](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#keySet())() Returns a `Set` of all keys contained in this `ResourceBundle` and its parent bundles. |
| void | [setParent](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#setParent(java.util.ResourceBundle))([ResourceBundle](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html) parent) Sets the parent bundle of this bundle. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**PropertyResourceBundle**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) stream)

Creates a property resource bundle from an `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html`. The property file read with this constructor
must be encoded in ISO-8859-1.

##### Parameters

| stream | an InputStream that represents a property file to read from. |
|---|---|

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `stream` is null |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `stream` contains a malformed Unicode escape sequence. |
|---|---|

#### public
**PropertyResourceBundle**
([Reader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Reader.html) reader)

Creates a property resource bundle from a `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Reader.html`. Unlike the constructor
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PropertyResourceBundle.html#PropertyResourceBundle(java.io.InputStream)`,
there is no limitation as to the encoding of the input property file.

##### Parameters

| reader | a Reader that represents a property file to read from. |
|---|---|

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `reader` is null |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if a malformed Unicode escape sequence appears from `reader`. |
|---|---|

## Public Methods

#### public [Enumeration](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Enumeration.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\>
**getKeys**
()

Returns an `Enumeration` of the keys contained in
this `ResourceBundle` and its parent bundles.

##### Returns

- an `Enumeration` of the keys contained in this `ResourceBundle` and its parent bundles.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#keySet()`

#### public [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**handleGetObject**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) key)

Gets an object for the given key from this resource bundle.
Returns null if this resource bundle does not contain an
object for the given key.

##### Parameters

| key | the key for the desired object |
|---|---|

##### Returns

- the object for the given key, or null

## Protected Methods

#### protected [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\>
**handleKeySet**
()

Returns a `Set` of the keys contained
*only* in this `ResourceBundle`.

##### Returns

- a `Set` of the keys contained only in this `ResourceBundle`

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/ResourceBundle.html#keySet()`