Java Properties Load from File loadPropertiesFromPath(String propsFilePath)

Here you can find the source of loadPropertiesFromPath(String propsFilePath)

Description

load Properties From Path

License

Open Source License

Declaration

public static Properties loadPropertiesFromPath(String propsFilePath)
            throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.*;

import java.util.*;

public class Main {
    public static Properties loadPropertiesFromPath(String propsFilePath)
            throws IOException {
        InputStream is = null;//from ww  w  .  ja  v a  2 s  . c  om
        try {
            is = new BufferedInputStream(new FileInputStream(propsFilePath));
            Properties props = new Properties();
            props.load(is);
            return props;
        } finally {
            close(is);
        }
    }

    public static void close(Reader in) {
        try {
            in.close();
        } catch (Exception x) {
            // ignore
        }
    }

    public static void close(Writer out) {
        try {
            out.close();
        } catch (Exception x) {
            // ignore
        }
    }

    public static void close(InputStream in) {
        try {
            in.close();
        } catch (Exception x) {
            // ignore
        }
    }

    public static void close(OutputStream os) {
        try {
            os.close();
        } catch (Exception x) {
            // no op
        }
    }
}

Related

  1. loadPropertiesFromFile(JarFile jar)
  2. loadPropertiesFromFile(String configFile)
  3. loadPropertiesFromFile(String filePath)
  4. loadPropertiesFromFile(String fullFileName)
  5. loadPropertiesFromFile(String pathname)
  6. loadPropertiesInClassPath(String propertiesFileName)
  7. loadProvidersConfiguration(Class base, String confPropertiesName)
  8. loadPythonScript(String pythonScriptName)
  9. loadReader(Reader stream)