cz.jalasoft.util.configuration.source.ClasspathConfigSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JalasoftUtils Show documentation
Show all versions of JalasoftUtils Show documentation
A collection of utility classes that might be useful.
The newest version!
package cz.jalasoft.util.configuration.source;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
/**
* @author Honza Lastovicka ([email protected])
* @since 2016-07-27.
*/
final class ClasspathConfigSource implements ConfigSource {
private final String name;
public ClasspathConfigSource(String name) {
this.name = name;
}
@Override
public Reader load() throws IOException {
InputStream input = getClass().getClassLoader().getResourceAsStream(name);
return new InputStreamReader(input);
}
@Override
public String name() {
return name;
}
}