FileDocCategorySizeDatePackage
MsgHelp.javaAPI DocAndroid 1.5 API2854Wed May 06 22:41:54 BST 2009org.apache.harmony.beans.internal.nls

MsgHelp

public final class MsgHelp extends Object
This class contains helper methods for loading resource bundles and formatting external message strings.

Fields Summary
private static final String
RESOURCE_NAME
name of the resource for this class
private static final ResourceBundle
THE_BUNDLE
the resource bundle for this class
Constructors Summary
Methods Summary
public static java.lang.StringgetString(java.lang.String msg)


     
        ResourceBundle rb = null;

        try {
            InputStream in = MsgHelp.class.getResourceAsStream(
                    RESOURCE_NAME);
            rb = new PropertyResourceBundle(in);
        } catch (IOException ex) {
            Logger.global.warning("Couldn't read resource bundle: " +
                    ex);
        } catch (RuntimeException ex) {
            // Shouldn't happen, but deal at least somewhat gracefully.
            Logger.global.warning("Couldn't find resource bundle: " +
                    ex);
        }

        THE_BUNDLE = rb;
    
        if (THE_BUNDLE == null) {
            return msg;
        }
        try {
            return THE_BUNDLE.getString(msg);
        } catch (MissingResourceException e) {
            return "Missing message: " + msg;
        }
    
public static java.lang.StringgetString(java.lang.String msg, java.lang.Object[] args)

        String format = msg;
        if (THE_BUNDLE != null) {
            try {
                format = THE_BUNDLE.getString(msg);
            } catch (MissingResourceException e) {
            }
        }

        return org.apache.harmony.luni.util.MsgHelp.format(format, args);