Package java.util

Examples of java.util.PropertyResourceBundle


  private static ResourceBundle resources = null;
 
  public static void initialize() {
    InputStream input_stream = (Localizer.class.getClassLoader().getResourceAsStream("org/jmule/ui/resources/internat/Language_en_US.properties"));
    try {
      resources = new PropertyResourceBundle(input_stream);

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here


            try {
        URL resourceUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile() + resource);
            System.out.println("Non GB resource, so trying server '" + resourceUrl.toExternalForm() + "'");
        InputStream in = resourceUrl.openStream();
        try {
          resourceBundle = new PropertyResourceBundle(in);
        }
        finally {
          closeStream(in);
        }
      } catch (IOException ioe) {
        ioe.printStackTrace();
      }
    }
   
    // If no resource bundle has yet been loaded, look for it in the class loader   
    if(resourceBundle == null && cl != null) {
        System.out.println("Must GB resource, so trying class load");
      InputStream in = cl.getResourceAsStream(resource);
      try {
        resourceBundle = new PropertyResourceBundle(in);
      } catch (IOException ioe) {
        ioe.printStackTrace();
      }
      finally {
        closeStream(in);
View Full Code Here

      for (ClassLoader classLoader : getResourceClassLoaders()) {
        InputStream in = classLoader.getResourceAsStream(resourceFamily + suffix);
        if (in != null) {
          final ResourceBundle parentResourceBundle = resourceBundle;
          try {
            resourceBundle = new PropertyResourceBundle(in) {
              {
                setParent(parentResourceBundle);
              }
            };
          } finally {
View Full Code Here

        JasperCompileManager.compileReport(new FileInputStream(jrxml));
      }

      ResourceBundle resourceBundle = null;
      try {
        resourceBundle = new PropertyResourceBundle(
            new FileInputStream(
              reportName+"_" + langId + ".properties"
            )
        );
      }
      catch (IOException ex1) {
        resourceBundle = new PropertyResourceBundle(
            new FileInputStream(
              reportName+".properties"
            )
        );
      }
View Full Code Here

   */
  protected ResourceBundle loadBundle (String prefix) {
    URL url = Thread.currentThread().getContextClassLoader().getResource(prefix + ".properties");
    if (url != null) {
      try {
        return new PropertyResourceBundle(url.openStream());
      } catch (IOException e) {
        throw ThrowableManagerRegistry.caught(e);
      }
    }
    return null;
View Full Code Here

    private PropertyResourceBundle getRAS(String res) throws Exception {
        InputStream ras = this.getClass().getResourceAsStream(res);
        if (ras == null){
            return null;
        }
        return new PropertyResourceBundle(ras);
    }
View Full Code Here

            if (defaultPRB == null){
                throw new IOException("Could not find required file: "+res);
            }
        } else if (checkUnexpected) {
            // Check all the keys are in the default props file
            PropertyResourceBundle prb = getRAS(res);
            if (prb == null){
                return;
            }
            final ArrayList<String> list = Collections.list(prb.getKeys());
            Collections.sort(list);
            Iterator<String> enumr = list.iterator();
            final boolean mainResourceFile = resname.startsWith("messages");
            while (enumr.hasNext()) {
                String key = enumr.next();
                try {
                    String val = defaultPRB.getString(key); // Also Check key is in default
                    if (mainResourceFile && val.equals(prb.getString(key))){
                        System.out.println("Duplicate value? "+key+"="+val+" in "+res);
                        subTestFailures++;
                    }
                } catch (MissingResourceException e) {
                    subTestFailures++;
View Full Code Here

    {
        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,
View Full Code Here

    {
        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,
View Full Code Here

        InputStream in = null;
        try {
            in = getFileFromClasspath(propertiesDir + "/" +
                                      packageName + ".properties");
            if (in != null) {
                bundle = new PropertyResourceBundle(in);
                bundles.put(packageName, bundle);
                return bundle;
            }
        } catch (Exception e) {
            e.printStackTrace();
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.