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(Properties properties, File propertyFile)
load Properties
try (FileInputStream inStream = new FileInputStream(propertyFile)) {
    properties.load(inStream);
} catch (IOException e) {
    throw new IllegalArgumentException(String.format("Error loading %s", propertyFile.getAbsolutePath()),
            e);
return properties;
PropertiesloadProperties(Properties properties, File propertyFile)
load Properties
try (FileInputStream inStream = new FileInputStream(propertyFile)) {
    properties.load(inStream);
} catch (IOException e) {
    throw new IllegalArgumentException(String.format("Error loading %s", propertyFile.getAbsolutePath()),
            e);
return properties;
PropertiesloadProperties(String configFilePath)
Load the Properties object from the configuration object.
InputStream in = null;
try {
    Properties prop = new Properties();
    in = new FileInputStream(configFilePath);
    prop.load(in);
    return prop;
} catch (IOException e) {
    return null;
...
PropertiesloadProperties(String configurationFileProperty, String configurationFileDefault)
load Properties
String propsFileUserPath = System.getProperty(configurationFileProperty, configurationFileDefault);
Properties props = new Properties();
props.load(new FileReader(new File(propsFileUserPath)));
return props;
PropertiesloadProperties(String configurationPath)
Load the properties for the application.
Properties props = new Properties();
try (FileInputStream inputStream = new FileInputStream(configurationPath)) {
    props.load(inputStream);
return props;
PropertiesloadProperties(String file)
load Properties
try {
    Properties properties = new Properties();
    InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
    if (in != null)
        properties.load(in);
    return properties;
} catch (IOException e) {
    return null;
...
PropertiesloadProperties(String filename)
load Properties
if (filename == null) {
    System.err.println("No " + filename + " properties file specified.");
    System.exit(1);
Properties props = new Properties();
try {
    FileInputStream fis = new FileInputStream(filename);
    if (fis == null) {
...
PropertiesloadProperties(String fileName)
load Properties
Properties properties = null;
InputStream stream = null;
try {
    stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
    if (null == stream) {
        throw new FileNotFoundException(fileName + "is Not Found");
    properties = new Properties();
...
PropertiesloadProperties(String filename)
load Properties
return loadProperties(new File(filename));
PropertiesloadProperties(String fileName)
load Properties
Properties prop = new Properties();
File file = new File(fileName);
BufferedInputStream in = null;
try {
    in = new BufferedInputStream(new FileInputStream(file));
    prop.load(in);
} catch (FileNotFoundException e) {
    e.printStackTrace();
...