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

Parameter

Parameter Description
filename a parameter

Exception

Parameter Description
IOException an exception

Declaration

public static Properties loadProperties(String filename) throws IOException 

Method Source Code


//package com.java2s;
import java.io.*;
import java.util.*;

public class Main {
    /**// ww w  . j  a  v a  2 s . co  m
     * @param filename
     * @return
     * @throws IOException
     */
    public static Properties loadProperties(String filename) throws IOException {
        return loadProperties(new File(filename));
    }

    /**
     * @param file
     * @return
     * @throws IOException
     */
    public static Properties loadProperties(File file) throws IOException {
        Properties properties = null;
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            properties = new Properties();
            properties.load(in);
        } finally {
            try {
                if (in != null)
                    in.close();
            } catch (IOException e) {
            }
        }
        return properties;
    }
}

Related

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