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

io.github.binaryfoo.res.ClasspathIO Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version
package io.github.binaryfoo.res;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class ClasspathIO {

    public static List readLines(String fileName) {
        try (InputStream in = open(fileName)) {
            return IOUtils.readLines(in);
        } catch (IOException e) {
            throw new RuntimeException("Failed to read " + fileName, e);
        }
    }

    public static InputStream open(String fileName) {
        return ClasspathIO.class.getClassLoader().getResourceAsStream(fileName);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy