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(File propertiesFile)
Loads a properties file.
if (!checkNotNull(propertiesFile).exists()) {
    return new Properties();
InputStream in = null;
try {
    in = new BufferedInputStream(new FileInputStream(propertiesFile));
    Properties properties = new Properties();
    if (propertiesFile.getName().endsWith(".xml")) {
...
Propertiesload(final Class key, final String env, final Properties defaults)
load
try (InputStream is = key.getResourceAsStream(env + ".properties")) {
    final Properties rval = new Properties(defaults);
    rval.load(is);
    return rval;
} catch (final Exception e) {
    return new Properties(defaults);
voidload(final Properties props, final Properties toLoad)
load
for (final String key : toLoad.stringPropertyNames()) {
    final String value = toLoad.getProperty(key);
    assert value != null;
    props.setProperty(key, value);
Propertiesload(final String folder, final String fileName)
load
final Properties properties = new Properties();
try (InputStream in = new FileInputStream(new File(folder, fileName))) {
    properties.load(in);
return properties;
Propertiesload(InputStream in)
load
Properties p = new Properties();
try {
    p.load(in);
} catch (FileNotFoundException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
return p;
voidload(InputStream input)
load
Properties props = new Properties();
try {
    props.load(input);
} catch (IOException e) {
} finally {
    if (input != null)
        try {
            input.close();
...
LinkedHashMapload(InputStream inputStream)
load
LinkedHashMap<String, String> properties = new LinkedHashMap<String, String>();
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
while (true) {
    String line = in.readLine();
    if (line == null)
        return properties;
    if (line.length() > 0) {
        int len = line.length();
...
Stringload(InputStream is)
load
try (BufferedReader in = new BufferedReader(new InputStreamReader(is))) {
    String line;
    StringBuilder responseData = new StringBuilder();
    while ((line = in.readLine()) != null) {
        responseData.append(line).append(NEW_LINE);
    return responseData.toString();
voidload(InputStream stream)
load
load(stream, false);
voidload(Map map, String fileName)
load
if (new File(fileName).exists()) {
    try {
        load(map, new FileInputStream(fileName));
    } catch (FileNotFoundException e) {
        throw new RuntimeException(e);