Java Utililty Methods Properties Load from File

List of utility methods to do Properties Load from File

Description

The list of methods to do Properties Load from File are organized into topic(s).

Method

PropertiesloadProperties(String propertyPath)
Load the properties found in the class path and merge them to the system properties in a way that the system properties supersede the properties found in the class path.
Properties p = new Properties();
InputStream propsFileStream = Thread.currentThread().getContextClassLoader()
        .getResourceAsStream(propertyPath);
if (propsFileStream == null)
    throw new FileNotFoundException(propertyPath);
p.load(propsFileStream);
Enumeration e = System.getProperties().keys();
while (e.hasMoreElements()) {
...
PropertiesloadProperties(String propsFile)
Creates a new Properties object from the properties file located at the argument location
Properties ret = new Properties();
try {
    File test = new File(propsFile);
    if (!test.exists()) {
        RuntimeException re = new RuntimeException("Could not find the properties file: " + propsFile);
        throw re;
    InputStream in = new FileInputStream(propsFile);
...
PropertiesloadProperties(String sFile)
Me-load file properties
Properties p = new Properties();
try {
    FileInputStream in = new FileInputStream(sFile);
    p.load(in);
    in.close();
} catch (IOException ex) {
    System.out.println(ex.getMessage());
return p;
PropertiesloadPropertiesFile(File file, boolean critical)
load Properties File
Properties configProps = new Properties();
InputStream is = null;
try {
    is = new FileInputStream(file);
    configProps.load(is);
} catch (FileNotFoundException ex) {
    if (critical) {
        throw ex;
...
PropertiesloadPropertiesFile(final File file)
Loads the given file as a Properties file.
FileInputStream in = new FileInputStream(file);
try {
    final Properties rv = new Properties();
    rv.load(in);
    return rv;
} finally {
    in.close();
PropertiesloadPropertiesFile(String fileName)
Load properties file.
Properties props = new Properties();
FileInputStream is = null;
try {
    is = new FileInputStream(fileName);
    props.load(is);
} catch (IOException e) {
    return null;
} finally {
...
PropertiesloadPropertiesFile(String fileName)
load Properties File
Properties properties = new Properties();
InputStream input = null;
try {
    input = new FileInputStream(fileName);
    properties.load(input);
    return properties;
} finally {
    if (input != null) {
...
PropertiesloadPropertiesFile(String filePath)
Methode de chargement d'un fichier de proprietes
if (filePath == null || filePath.trim().isEmpty())
    throw new RuntimeException(
            "Erreur lors du chargement du fichier de proprietes: Le chemin du fichier n'est pas renseigne");
String completeFilePath = filePath.trim();
InputStream stream = null;
try {
    stream = new FileInputStream(completeFilePath);
} catch (FileNotFoundException e) {
...
PropertiesloadPropertiesFile(String filePath)
load Properties File
Properties properties = new Properties();
InputStream is = null;
try {
    try {
        is = new FileInputStream(filePath);
        properties.load(is);
    } finally {
        if (is != null) {
...
PropertiesloadPropertiesFile(String path)
load Properties File
Properties properties = new Properties();
try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
    properties.load(reader);
} catch (FileNotFoundException ex) {
    ex.printStackTrace();
} catch (IOException ex) {
    ex.printStackTrace();
return properties;