Java Properties Load loadProperties(Properties properties, Class clazz, String propDir, String name)

Here you can find the source of loadProperties(Properties properties, Class clazz, String propDir, String name)

Description

load Properties

License

Open Source License

Declaration

public static void loadProperties(Properties properties, Class clazz, String propDir, String name) 

Method Source Code


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

public class Main {
    public static void loadProperties(Properties properties, Class clazz, String propDir, String name) {
        // load system defaults
        try {/*from  w w w  .  j  a v a2  s.c  o  m*/
            properties.load(clazz.getResourceAsStream(name));
        } catch (IOException ioe) {
            System.err.println("Could not load aid property file: " + name);
            System.err.println(ioe);
        }

        // load user defaults
        try {
            if ((propDir != null) && !propDir.equals(".") && !propDir.equals("")) {
                name = propDir + File.separator + name;
            }
            properties.load(new FileInputStream(name));
            //            System.out.println("Loaded user property file: "+name);
        } catch (IOException ioe) {
        }
    }
}

Related

  1. loadProperties(ByteSource is)
  2. loadProperties(Class clazz, String name)
  3. loadProperties(Class clazz)
  4. loadProperties(Class clazz, String name)
  5. loadProperties(Properties p, String progname)
  6. loadProperties(Properties properties, Class baseClass, String... propertiesName)
  7. loadProperties(Properties props, final Class clazz, final String resourceName)
  8. loadProperties(String bucketName, String key)
  9. loadProperties(String conf)