All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.httpcache4j.util.PropertiesLoader Maven / Gradle / Ivy

There is a newer version: 5.1.1
Show newest version
package org.codehaus.httpcache4j.util;

import java.io.*;
import java.util.Properties;

public final class PropertiesLoader {
    private PropertiesLoader() {
    }

    public static Properties get(Reader reader) {
        Properties properties = new Properties();
        try {
            properties.load(reader);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        finally {
            IOUtils.closeQuietly(reader);
        }
        return properties;
    }

    public static Properties get(InputStream stream) {
        Properties properties = new Properties();
        try {
            properties.load(stream);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        finally {
            IOUtils.closeQuietly(stream);
        }
        return properties;
    }

    public static Properties get(File file) {
        try {
            return get(new FileInputStream(file));
        } catch (FileNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy