is the
* german ä)
*
*
s1=3
s2=MeineDisk
s3=3. M\u00e4rz 96
s4=Die Diskette ''{1}'' enth\u00e4lt {0} in {2}.
s5=0
s6=keine Dateien
s7=1
s8=eine Datei
s9=2
s10={0,number} Dateien
s11=Die Formatierung warf eine Exception: {0}
s12=FEHLER
s13=Ergebnis
s14=Dialog
s15=Auswahlkriterium
s16=1,3
*
* @author Jochen Hoenicke
* @see ResourceBundle
* @see ListResourceBundle
* @see Properties#load()
* @since 1.1
* @status updated to 1.4
*/
public class PropertyResourceBundle extends ResourceBundle
{
/** The properties file this bundle is based on. */
private Properties properties;
/**
* Creates a new property resource bundle.
*
* @param stream an input stream, where the resources are read from
* @throws NullPointerException if stream is null
* @throws IOException if reading the stream fails
*/
public PropertyResourceBundle(InputStream stream) throws IOException
{
properties = new Properties();
properties.load(stream);
}
/**
* Called by getObject
when a resource is needed. This
* returns the resource given by the key.
*
* @param key the key of the resource
* @return the resource for the key, or null if it doesn't exist
*/
public Object handleGetObject(String key)
{
return properties.getProperty(key);
}
/**
* This method should return all keys for which a resource exists.
*
* @return an enumeration of the keys
*/
public Enumeration getKeys()
{
if (parent == null)
return properties.propertyNames();
// We make a new Set that holds all the keys, then return an enumeration
// for that. This prevents modifications from ruining the enumeration,
// as well as ignoring duplicates.
Set s = new HashSet();
Enumeration e = properties.propertyNames();
while (e.hasMoreElements())
s.add(e.nextElement());
ResourceBundle bundle = parent;
// Eliminate tail recursion.
do
{
e = bundle.getKeys();
while (e.hasMoreElements())
s.add(e.nextElement());
bundle = bundle.parent;
}
while (bundle != null);
return Collections.enumeration(s);
}
} // class PropertyResourceBundle