Java Properties Load from File load(File f)

Here you can find the source of load(File f)

Description

load

License

Apache License

Declaration

public static Properties load(File f) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.FileInputStream;

import java.io.IOException;
import java.io.InputStream;

import java.util.Properties;

public class Main {
    public static void load(Properties props, File f) throws IOException {
        InputStream is = null;/*from  w w w .j  a  v  a 2s.  co  m*/
        try {
            is = new FileInputStream(f);
            props.load(is);
        } finally {
            if (is != null) {
                is.close();
            }
        }
    }

    public static void load(Properties props, InputStream is) throws IOException {
        try {
            props.load(is);
        } finally {
            is.close();
        }
    }

    public static Properties load(File f) throws IOException {
        Properties p = new Properties();
        load(p, f);
        return p;
    }
}

Related

  1. load(boolean loadAsResourceBundle, String name, ClassLoader loader)
  2. load(Class type, String resource, Properties map)
  3. load(Class cls)
  4. load(File file)
  5. load(File file)
  6. load(File file)
  7. load(File file)