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

Propertiesload(String filename)
Loads a properties from a file name.
Properties p = new Properties();
FileInputStream inStream = new FileInputStream(filename);
p.load(inStream);
inStream.close();
return p;
Mapload(String filename)
load
if (!filename.endsWith("properties"))
    filename += ".properties";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
return load(is);
Propertiesload(String fileName)
load
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
return load(is);
Propertiesload(String path)
load
Properties props = new Properties();
try {
    props.load(new FileInputStream(path));
} catch (FileNotFoundException e) {
    new RuntimeException("Error loading properties: " + path, e);
} catch (IOException e) {
    new RuntimeException("Error loading properties: " + path, e);
return props;
Propertiesload(String propertiesString)
load
Properties properties = new Properties();
if (propertiesString != null)
    properties.load(new StringReader(propertiesString));
return properties;
Propertiesload(String resource)
load
InputStream in = null;
Properties prop = new Properties();
try {
    in = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
    prop.load(in);
} catch (Exception e) {
    e.printStackTrace();
    if (in != null) {
...
Mapload(String resource)
Load properties from the given name resource.
Properties p = new Properties();
try {
    InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
    if (stream == null) {
        stream = new FileInputStream(resource);
    p.load(stream);
} catch (Exception e) {
...
Propertiesload(String[] paths, String fileName)
Load the specified properties file from one of the specified set of paths.
Properties properties = null;
File propertiesFile = null;
try {
    String path = null;
    for (int i = 0; i < paths.length; i++) {
        path = paths[i] + File.separator + fileName;
        propertiesFile = new File(path);
        if (propertiesFile.exists())
...
PropertiesloadAccessTokenProperties(InputStream inputStream)
load Access Token Properties
Properties properties = new Properties();
try {
    properties.load(inputStream);
} catch (IOException ioException) {
return properties;
PropertiesloadApiProperties(InputStream inputStream)
load Api Properties
Properties properties = new Properties();
properties.load(inputStream);
return properties;