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

PropertiesloadBuildProperties(File projectRootDir)
load Build Properties
File file = new File(projectRootDir, "build.properties");
Properties buildProperties = new Properties();
if (file.canRead()) {
    InputStream is = null;
    try {
        try {
            is = new FileInputStream(file);
            buildProperties.load(is);
...
intloadCfg(String url)

Description:TODO

Properties prop = new Properties();
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(url);
try {
    prop.load(in);
    DRIVER = prop.get("jdbc.driverClassName").toString();
    URL = prop.get("jdbc.url").toString();
    USERNAME = prop.get("jdbc.username").toString();
    PASSWORD = prop.get("jdbc.password").toString();
...
PropertiesloadConfig(File settingsFile)
load Config
Properties loadedProperties = new Properties();
if (settingsFile.exists()) {
    FileInputStream settingsIn = new FileInputStream(settingsFile);
    loadedProperties.load(settingsIn);
    settingsIn.close();
return loadedProperties;
PropertiesloadConfigByPath(String path)
load Config By Path
FileInputStream fi = new FileInputStream(path);
return loadProperty(fi);
voidloadConfigProperties()
reads values from config property file
Properties properties = new Properties();
InputStream inputStream = null;
try {
    File file = new File((new File(".")).getCanonicalPath() + File.separator + "resources" + File.separator
            + "config.properties");
    if (file.exists()) {
        inputStream = new FileInputStream(file);
    } else {
...
PropertiesloadConfigProperties()
reads values from config property file
Properties properties = new Properties();
InputStream inputStream = null;
try {
    File file = new File((new File(".")).getCanonicalPath() + File.separator + "src" + File.separator
            + "main" + File.separator + "resources" + File.separator + "config.properties");
    if (file.exists()) {
        inputStream = new FileInputStream(file);
    } else {
...
voidloadConfiguration()
load Configuration
Properties properties = new Properties();
FileInputStream freader = new FileInputStream(PROPERTIES_FILE_NAME);
properties.load(freader);
userEndpointURL = properties.getProperty(PROPERTY_NAME_USER_ENDPOINT_URL);
groupEndpointURL = properties.getProperty(PROPERTY_NAME_GROUP_ENDPOINT_URL);
userName = properties.getProperty(PROPERTY_NAME_USER_NAME);
password = properties.getProperty(PROPERTY_NAME_PASSWORD);
String isOAuth = properties.getProperty(PROPERTY_NAME_ENABLE_OAUTH);
...
voidloadConfiguration(String file)
Load a Java properties file into the system properties.
Properties p = new Properties();
FileInputStream in = new FileInputStream(file);
p.load(in);
in.close();
for (Iterator i = p.keySet().iterator(); i.hasNext();) {
    String key = (String) i.next();
    System.setProperty(key, p.getProperty(key));
DictionaryloadConfiguration(String filePath)
load Configuration
File file = new File(filePath);
FileInputStream stream = new FileInputStream(file);
Properties p = new Properties();
try {
    p.load(stream);
} finally {
    if (stream != null)
        stream.close();
...
voidloadCredentials(File credentials, String credentialsAppend)
load Credentials
InputStream propertiesFileStream = new FileInputStream(credentials);
if (propertiesFileStream == null) {
    throw new IOException("Credentials stream is invalid.");
Properties prop = new Properties();
prop.load(propertiesFileStream);
if (prop.containsKey("user.name" + credentialsAppend)) {
    username = prop.getProperty("user.name" + credentialsAppend);
...