Files
aadd_fic10/src/org/palomafp/aadd/jx/GestorPropiedad.java
T
2026-10-15 16:42:57 +02:00

37 lines
1.0 KiB
Java

package org.palomafp.aadd.jx;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Properties;
public class GestorPropiedad {
private static final String FICHERO_PROPIEDADES = "application.properties";
private static Properties propiedades = new Properties();
static {
try (InputStream is = GestorPropiedad.class.getClassLoader().getResourceAsStream(FICHERO_PROPIEDADES)) {
if (is == null) {
throw new RuntimeException("No se ha podido cargar el fichero de configuración: " + FICHERO_PROPIEDADES);
}
try (BufferedReader entrada = new BufferedReader(new InputStreamReader(is, StandardCharsets.ISO_8859_1))) {
propiedades.load(entrada);
}
} catch (IOException e) {
throw new RuntimeException("Error al cargar el archivo de propiedades: " + e.getMessage(), e);
}
}
public static String get(String clave) {
return propiedades.getProperty(clave);
}
}