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

voidloadCryptoProperties()
load Crypto Properties
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Properties properties = new Properties();
InputStream is = cl.getResourceAsStream(CRYPTO_PROPERTIES);
properties.load(is);
keyAlgorithm = properties.getProperty(CRYPTO_KEY_ALGORITHM);
rngAlgorithm = properties.getProperty(CRYPTO_RNG_ALGORITHM);
String v = properties.getProperty(CRYPTO_ITERATIONS);
iterations = Integer.parseInt(v);
...
PropertiesloadDBProperties(String dbConn)
Load a properties file describing the database properties for connecting to
if (dbConn == null)
    return null;
else {
    String wd = System.getProperty("user.dir");
    File wdDir = new File(wd);
    Properties props = new Properties();
    try {
        FileInputStream fis = new FileInputStream(wdDir + File.separator + dbConn + ".properties");
...
PropertiesloadDefault(String _file_path)
load Default
Properties defaultProps = new Properties();
FileInputStream in;
try {
    in = new FileInputStream(_file_path);
    defaultProps.load(in);
    in.close();
} catch (FileNotFoundException e) {
    System.out.println("[PropertiesUtils.loadDefault] no properties file to load for default properties");
...
voidloadDefaultConfiguration()
Loads the default logging configuration properties from the classpath.
loadDefaultConfiguration(null);
voidloadDefaultProps(Properties deployProps)
load Default Props
FileInputStream fis = null;
try {
    String flnm = getPropertiesPath() + File.separator + "default-deploy.properties";
    fis = new FileInputStream(flnm);
    deployProps.load(fis);
} catch (Exception ex) {
    ex.printStackTrace();
} finally {
...
voidLoadDeployedObjects(String outputDirectory)
Load Deployed Objects
String file = outputDirectory + "/savedobjects/" + DEPLOYED_OBJECT_FILE;
if (FileExists(file)) {
    try {
        FileInputStream inputStream = new FileInputStream(file);
        deployedObjectsList.load(inputStream);
        inputStream.close();
    } catch (Exception e) {
        e.printStackTrace();
...
MaploadEnv(final String configFilePath)
initialize environment using the incoming properties file (or defaults).
final Properties props = new Properties();
if (configFilePath != null) {
    FileInputStream fis = null;
    try {
        fis = new FileInputStream(new File(configFilePath));
        props.load(fis);
    } catch (IOException e) {
    } finally {
...
MaploadErrorMap(InputStream resourceStream)
Loads the mapping from error codes to error messages from a properties file.
Properties prop = new Properties();
Map<Integer, String> errorMessageMap = new HashMap<>();
prop.load(resourceStream);
for (Map.Entry<Object, Object> entry : prop.entrySet()) {
    String key = (String) entry.getKey();
    String msg = (String) entry.getValue();
    if (key.contains(COMMA)) {
        String[] codes = key.split(COMMA);
...
voidloadEscaping(Properties prop, InputStream stream)
Loads the given properties from the given input stream.
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while (true) {
    int b = stream.read();
    if (b == -1) {
        break;
    } else if (b == '\\') {
    bos.write(b);
...
voidloadFixedCommits()
load Fixed Commits
String userHomeDir = System.getProperty("user.home");
String bugRepoPath = userHomeDir + "/git/BLIA/data/";
Scanner bugRepoRead = new Scanner(new File(bugRepoPath + FIXED_COMMIT_FILE));
while (bugRepoRead.hasNextLine()) {
    String line = bugRepoRead.nextLine();
    String[] items = line.split(" ");
    String bugID = items[0];
    HashSet<String> hashSet = fixedCommitMap.get(bugID);
...