Package java.util

Examples of java.util.PropertyResourceBundle


     */
    public PropertyResourceBundle getPluginProperties() {

        if(properties == null) {
            try {
                properties = new PropertyResourceBundle(FileLocator.openStream(this.getBundle(), new Path(
                        "plugin.properties"), false)); //$NON-NLS-1$
            }
            catch(IOException e) {
                // We can't use the PLUGIN_ID constant since loading the plugin.properties file has failed,
                // So we're using a default plugin id.
View Full Code Here


  public EnhancedPropertyBundle (InputStream inputStream,
                                 String resourceName)
    throws IOException {

    propertyBundle = new PropertyResourceBundle (inputStream);
    this.resourceName = resourceName;
  }
View Full Code Here

                        // for this component is successful, the ResourceBundle is wrapped in a Map<String, String> and
                        // returned.
                        try
                        {
                            _resourceBundleMap
                                    = new BundleMap(new PropertyResourceBundle(bundleResource.getInputStream()));
                        }
                        catch (IOException e1)
                        {
                            // Nothing happens, then resourceBundleMap is set as empty map
                        }
View Full Code Here

                        // is used to create a ResourceBundle. If either of the two previous steps for obtaining the
                        // ResourceBundle
                        // for this component is successful, the ResourceBundle is wrapped in a Map<String, String> and
                        // returned.
                        try {
                            _resourceBundleMap = new BundleMap(new PropertyResourceBundle(bundleResource.getInputStream()));
                        } catch (IOException e1) {
                            // Nothing happens, then resourceBundleMap is set as empty map
                        }
                    }
                }
View Full Code Here

                        // for this component is successful, the ResourceBundle is wrapped in a Map<String, String> and
                        // returned.
                        try
                        {
                            _resourceBundleMap
                                    = new BundleMap(new PropertyResourceBundle(bundleResource.getInputStream()));
                        }
                        catch (IOException e1)
                        {
                            // Nothing happens, then resourceBundleMap is set as empty map
                        }
View Full Code Here

            throws IOException {
        InputStream is = GWTDictionaryBuilder.class.getClassLoader().getResourceAsStream(bundleName.replace('.', '/') + ".properties");
        if (is == null) {
            throw new FileNotFoundException("ERROR : Couldn't find bundle with name " + bundleName.replace('.', '/') + ".properties in class loader, skipping...");
        }
        ResourceBundle defBundle = new PropertyResourceBundle(is);
        is.close();

        ResourceBundle bundle = null;
        if (locale != null) {
            try {
                bundle = ResourceBundle.getBundle(bundleName, locale);
            } catch (MissingResourceException e) {
                bundle = defBundle;
            }
        } else {
            bundle = defBundle;
        }
        File target = new File(targetFolder, targetFileName + (locale != null ? "_" + locale.toString() : "") + ".js");
        System.out.print("Creating " + target + " ...");
        PrintWriter out = new PrintWriter(target);
        Enumeration<String> keyEnum = defBundle.getKeys();
        List<String> keys = new LinkedList<String>();
        while (keyEnum.hasMoreElements()) {
            keys.add(keyEnum.nextElement());
        }
        Collections.sort(keys);
        out.print("var " + Messages.DICTIONARY_NAME + "={");
        if (!minified) {
            out.println();
        }
        for (Iterator<String> iterator = keys.iterator(); iterator.hasNext();) {
            String key = iterator.next();
            String value = null;
            try {
                value = bundle.getString(key);
            } catch (MissingResourceException e) {
                try {
                    value = defBundle.getString(key);
                } catch (MissingResourceException e2) {
                    value = null;
                }
            }
            if (value != null) {
View Full Code Here

    public ResourceBundleWebServerConfig() throws IOException {

        File file = new File(System.getProperty("basedir"), "ResourceBundleWebServerConfig.properties");
        // how do you get this working in intellij, maven and eclipse ?
        if (file.exists()) {
            ResourceBundle bundle = new PropertyResourceBundle(new FileInputStream(file));
            host = bundle.getString("host");
            port = Integer.parseInt(bundle.getString("port"));
        }
    }
View Full Code Here

   */
  public static ResourceBundle getResourceBundle(Locale pLocale, File pFile) {
    sLog.info("Trying to open : " + pFile.getAbsolutePath());
    try {
      FileInputStream lStream = new FileInputStream(pFile);
      PropertyResourceBundle lBundle = new PropertyResourceBundle(lStream);
      // Note the local is not set for this bundle, so we keep track in
      // another field.
      sCurrent = pLocale;
      lStream.close();
      return lBundle;
View Full Code Here

          // there's no reason to give this warning more than once
          ignoreMissingProperties = true;
        }
        return;
      }
      resources = new PropertyResourceBundle(in);
    } catch (MissingResourceException mre) {
      if (!ignoreMissingProperties) {
        System.err.println("Cannot read "+propertyFile);
      }
    } catch (java.io.IOException e) {
View Full Code Here

     * Returns the message string with the specified key from the
     * "properties" file in the package containing the class with
     * the specified name.
     */
    protected static final String getString(String className, String resource_name, String key) {
        PropertyResourceBundle bundle = null;
        try {
            InputStream stream =
                Class.forName(className).getResourceAsStream(resource_name);
            bundle = new PropertyResourceBundle(stream);
        } catch(Throwable e) {
            throw new RuntimeException(e); // Chain the exception.
        }

        return (String)bundle.handleGetObject(key);
    }
View Full Code Here

TOP

Related Classes of java.util.PropertyResourceBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.