blob: 7f9ec44fe5e5c5845271dca6b02ff76f72a9e492 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/**
* <copyright>
*
* Copyright (c) 2002-2007 itemis AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* itemis AG - Initial API and implementation
*
* </copyright>
*
*/
package org.eclipse.xpand3.util;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
/**
* @author Sven Efftinge
*
*/
public class ClassLoaderLoaderImpl implements Loader {
private ClassLoader classLoader;
/**
* @param contextClassLoader
*/
public ClassLoaderLoaderImpl(ClassLoader contextClassLoader) {
this.classLoader = contextClassLoader;
}
public URL getResource(String name) {
return classLoader.getResource(name);
}
public InputStream getResourceAsStream(String name) {
return classLoader.getResourceAsStream(name);
}
public Enumeration<URL> getResources(String name) {
try {
return classLoader.getResources(name);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public Class<?> loadClass(String name) {
try {
return classLoader.loadClass(name);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
/**
* @return the class loader
*/
public ClassLoader getClassLoader() {
return classLoader;
}
}
|