Java URL Load loadFromURL(URL url)

Here you can find the source of loadFromURL(URL url)

Description

load From URL

License

Apache License

Declaration

public static Properties loadFromURL(URL url) throws MalformedURLException, IOException 

Method Source Code

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

import java.io.FileInputStream;

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

import java.net.MalformedURLException;
import java.net.URL;

import java.util.Properties;

public class Main {
    public static Properties loadFromURL(URL url) throws MalformedURLException, IOException {
        Properties result = new Properties();
        InputStream is = null;//  www .j a  v a  2s . com
        try {
            is = url.openStream();
            result.load(is);
        } finally {
            if (is != null) {
                is.close();
            }
        }
        return result;
    }

    public static Properties load(String fileName) throws IOException {
        InputStream is = null;
        try {
            Properties props = new Properties();
            is = new FileInputStream(fileName);
            props.load(is);
            return props;
        } finally {
            if (is != null) {
                is.close();
            }
        }
    }
}

Related

  1. loadFile(URL url)
  2. loadFileNoArray(URL f)
  3. loadFileOrUrlToList(String iFileOrUrl)
  4. loadFromUrl(String url)
  5. loadFromURL(URL url)
  6. loadFromURL(URL url)
  7. loadFully(URL url)
  8. loadFully(URL url)
  9. loadImplementations(URL url, ClassLoader loader)