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

com.tngtech.propertyloader.impl.openers.ClassLoaderOpener Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
package com.tngtech.propertyloader.impl.openers;

import com.tngtech.propertyloader.impl.interfaces.PropertyLoaderOpener;

import java.io.InputStream;

/**
 * Searches for properties files using a provided ClassLoader.
 */
public class ClassLoaderOpener implements PropertyLoaderOpener {

    private final ClassLoader classLoader;

    public ClassLoaderOpener(ClassLoader classLoader) {
        this.classLoader = classLoader;
    }

    public InputStream open(String fileName) {
        return classLoader.getResourceAsStream(fileName);
    }

    @Override
    public String toString() {
        return "by classloader " + classLoader;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy