Source Code : Method to convert a ResourceBundle to a Properties object.
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Method to convert a ResourceBundle to a Properties object.
import java.util.Enumeration;
import java.util.Properties;
import java.util.ResourceBundle;
/**
* Utility class to convert one object to another.
*
* @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
*/
public final class Util {
/**
* Method to convert a ResourceBundle to a Properties object.
* @param rb a given resource bundle
* @return Properties a populated properties object
*/
public static Properties convertBundleToProperties(ResourceBundle rb) {
Properties props = new Properties();
for (Enumeration<String> keys = rb.getKeys(); keys.hasMoreElements();) {
String key = keys.nextElement();
props.put(key, rb.getString(key));
}
return props;
}
}
Thank with us