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

cz.jalasoft.util.configuration.source.ClasspathConfigSource Maven / Gradle / Ivy

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy