FileDocCategorySizeDatePackage
ResourceManager.javaAPI DocphoneME MR2 API (J2ME)5399Fri May 04 08:29:12 BST 2007javax.microedition.global

ResourceManager

public class ResourceManager extends Object

Fields Summary
private static com.sun.j2me.global.ResourceAbstractionLayer
abstractionLayer
The instance of ResourceAbstractionLayer.
public static final String
DEVICE
private String
baseName
The base name.
private String
locale
The locale identifier.
private com.sun.j2me.global.ResourceManager
rm
The resource manager object.
Constructors Summary
private ResourceManager(com.sun.j2me.global.ResourceManager rm)

        this.rm = rm;
    
Methods Summary
public java.lang.StringgetBaseName()

        return rm.getBaseName();
    
public byte[]getData(int id)

        return rm.getData(id);
    
public java.lang.StringgetLocale()

        return rm.getLocale();
    
public static final javax.microedition.global.ResourceManagergetManager(java.lang.String baseName)


    // JAVADOC COMMENT ELIDED 
         
               
        // get system locale
        String locale = System.getProperty("microedition.locale");
        if (locale == null) {
            throw new ResourceException(
                    ResourceException.NO_SYSTEM_DEFAULT_LOCALE,
                    "System default locale is undefined");
        }
        return getManager(baseName, locale);
    
public static final javax.microedition.global.ResourceManagergetManager(java.lang.String baseName, java.lang.String locale)

        if (baseName == null) {
            throw new NullPointerException("Base name is null");
        }

        if (locale == null) {
            throw new NullPointerException("Locale is null");
        }

        if (!LocaleHelpers.isValidLocale(locale) && !("".equals(locale))) {
            throw new IllegalArgumentException("Invalid locale format");
        }

        locale = LocaleHelpers.normalizeLocale(locale);

        return new ResourceManager(
            com.sun.j2me.global.ResourceManager.getManager(baseName, locale));
    
public static final javax.microedition.global.ResourceManagergetManager(java.lang.String baseName, java.lang.String[] locales)


        if (baseName == null) {
            throw new NullPointerException("Base name is null");
        }

        if (locales == null) {
            throw new NullPointerException("Locales array is null");
        }

        if (locales.length == 0) {
            throw new IllegalArgumentException("Empty locales array");
        }

        for (int i = 0; i < locales.length; i++) {
            if (locales[i] == null) {
                throw new NullPointerException("Locale at position " +
                                                i + " is null");
            }
            if (!LocaleHelpers.isValidLocale(locales[i]) &&
                !("".equals(locales[i]))) {
                throw new IllegalArgumentException("Locale at position " +
                                                    i + " has invalid format");
            }
        }

        return new ResourceManager(
            com.sun.j2me.global.ResourceManager.getManager(baseName, locales));
    
public java.lang.ObjectgetResource(int id)

        return rm.getResource(id);
    
public java.lang.StringgetString(int id)

        return rm.getString(id);
    
public static java.lang.String[]getSupportedLocales(java.lang.String baseName)

        if (baseName == null) {
            throw new NullPointerException("Base name is null");
        }
        return com.sun.j2me.global.ResourceManager.
                                   getSupportedLocales(baseName);
    
public booleanisCaching()

        return rm.isCaching();
    
public booleanisValidResourceID(int id)

        return rm.isValidResourceID(id);