You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
533 B

import java.io.InputStream;
public class ResourceApi {
public InputStream getFileFromResourceAsStream(String fileName) {
//ClassLoader classLoader = getClass().getClassLoader();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream inputStream = classLoader.getResourceAsStream(fileName);
if (inputStream == null) {
throw new IllegalArgumentException("file not found! " + fileName);
} else {
return inputStream;
}
}
}