Java Resource File getEntriesFromResourceBundle(String rbName, Map map)

Here you can find the source of getEntriesFromResourceBundle(String rbName, Map map)

Description

This method loads the resource bundle & puts all the values in map

License

CDDL license

Parameter

Parameter Description
String rbName Resource bundle name
Map m will be populated with resource bundle data

Declaration

public static void getEntriesFromResourceBundle(String rbName, Map map) 

Method Source Code

//package com.java2s;
/* The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the License). You may not use this file except in
 * compliance with the License.//  w  w w  . j av a  2  s .c o m
 *
 * You can obtain a copy of the License at
 * https://opensso.dev.java.net/public/CDDLv1.0.html or
 * opensso/legal/CDDLv1.0.txt
 * See the License for the specific language governing
 * permission and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL
 * Header Notice in each file and include the License file
 * at opensso/legal/CDDLv1.0.txt.
 * If applicable, add the following below the CDDL Header,
 * with the fields enclosed by brackets [] replaced by
 * your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * $Id: FedletCommon.java,v 1.3 2009-08-20 17:09:04 vimal_67 Exp $
 *
 * Copyright 2007 Sun Microsystems Inc. All Rights Reserved
 */

import java.util.Enumeration;
import java.util.Map;
import java.util.ResourceBundle;

public class Main {
    /**
     * This method loads the resource bundle & puts all the values in map
     * @param String rbName Resource bundle name
     * @param Map m will be populated with resource bundle data
     */
    public static void getEntriesFromResourceBundle(String rbName, Map map) {
        ResourceBundle rb = ResourceBundle.getBundle(rbName);
        for (Enumeration e = rb.getKeys(); e.hasMoreElements();) {
            String key = (String) e.nextElement();
            map.put(key, rb.getString(key));
        }
    }
}

Related

  1. getBundlesContainingResource(BundleContext bundleContext, String resourcePattern)
  2. getBytes(Class contextClass, String resourceName)
  3. getClassResource(Class clazz)
  4. getContentAsString(String resource)
  5. getDefaultWebXmlResourceLocation()
  6. getFile(Class clazz, String resource)
  7. getFile(Class resourceClass, String fileName)
  8. getFile(Class cls, String resource)
  9. getFile(String resource)