Java Properties Load from File loadProperties(String fileName)

Here you can find the source of loadProperties(String fileName)

Description

load Properties

License

Open Source License

Declaration

public static Properties loadProperties(String fileName) 

Method Source Code


//package com.java2s;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class Main {
    public static Properties loadProperties(String fileName) {
        Properties prop = new Properties();
        File file = new File(fileName);
        BufferedInputStream in = null;
        try {// w w w  .ja v a  2s  .  co  m
            in = new BufferedInputStream(new FileInputStream(file));
            prop.load(in);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    // do nothing
                }
            }
        }
        return prop;
    }
}

Related

  1. loadProperties(String configurationPath)
  2. loadProperties(String file)
  3. loadProperties(String filename)
  4. loadProperties(String fileName)
  5. loadProperties(String filename)
  6. loadProperties(String fileName, boolean systemOverride)
  7. loadProperties(String fileName, Properties properties)
  8. loadProperties(String filePath)
  9. loadProperties(String filePath)