>

17 agosto 2010

de ResourceBundle a Properties en java (ResourceBundle to Properties java)


package gl.jnovo;

import java.util.Enumeration;
import java.util.Properties;
import java.util.ResourceBundle;

public class ResourceBundleToProperties {

  public static void main(String[] args) {
    Properties genericProperties = new Properties();
    ResourceBundle bundle = ResourceBundle.getBundle("dsx");
    Enumeration claves = bundle.getKeys();
    while (claves.hasMoreElements()) {
      String clave = (String) claves.nextElement();
      String valor = bundle.getString(clave);
      genericProperties.put(clave, valor);
    }
  }

}

No hay comentarios: