Java URL Load readProperties(final URL url)

Here you can find the source of readProperties(final URL url)

Description

read Properties

License

Open Source License

Declaration

private static Properties readProperties(final URL url) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008, 2012 Sonatype Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:// w ww . j a  v  a 2 s  . c o m
 *    Sonatype Inc. - initial API and implementation
 *******************************************************************************/

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import java.util.Properties;

public class Main {
    private static Properties readProperties(final URL url) {
        Properties listProps = new Properties();
        InputStream stream = null;
        try {
            stream = url.openStream();
            listProps.load(stream);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                if (stream != null) {
                    stream.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return listProps;
    }
}

Related

  1. readMappingFile(final URL filename)
  2. readModelFromUrl(URL file, Class clazz)
  3. readNetFile(String urlstr)
  4. readPage(final String urlStr)
  5. readPage(URL url)
  6. readProperties(final URL url)
  7. readProperties(URL resource)
  8. readPropertyFile(URL url)
  9. readResource(final URL filename)