01: package liquibase;
02:
03: import java.io.IOException;
04: import java.io.InputStream;
05: import java.net.URL;
06: import java.util.Enumeration;
07:
08: /**
09: * An implementation of liquibase.FileOpener that opens file from the class loader.
10: *
11: * @see FileOpener
12: */
13: public class ClassLoaderFileOpener implements FileOpener {
14: public InputStream getResourceAsStream(String file)
15: throws IOException {
16: return getClass().getClassLoader().getResourceAsStream(file);
17: }
18:
19: public Enumeration<URL> getResources(String packageName)
20: throws IOException {
21: return getClass().getClassLoader().getResources(packageName);
22: }
23:
24: public ClassLoader toClassLoader() {
25: return getClass().getClassLoader();
26: }
27: }
|