com.tngtech.propertyloader.impl.openers.ClassLoaderOpener Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of property-loader Show documentation
Show all versions of property-loader Show documentation
The property loader is a java library for managing property configurations.
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;
}
}