1
2
3
4 package net.sourceforge.pmd.util.database;
5
6 import java.io.InputStream;
7
8
9
10
11
12 public class ResourceLoader {
13
14 public InputStream getResourceStream(String path) throws java.io.IOException {
15 ClassLoader cl = this.getClass().getClassLoader();
16 if (cl == null) {
17 cl = ClassLoader.getSystemClassLoader();
18 }
19 InputStream stream = cl.getResourceAsStream(path);
20 if (stream == null) {
21 throw new java.io.IOException("Resource not found: " + path);
22 }
23 return stream;
24 }
25
26 }