1:
8:
9: package ;
10: import ;
11: import ;
12: import ;
13: import ;
14: import ;
15: import ;
16:
17:
21:
22: public class SharedLibLoader extends ClassLoader
23: {
24:
29: public SharedLibLoader(String libname, ClassLoader parent, int flags)
30: {
31: super(parent);
32: URL url;
33: try
34: {
35: url = new URL("file", "", libname);
36: }
37: catch (MalformedURLException _)
38: {
39: url = null;
40: }
41: helper = SharedLibHelper.findHelper(this, libname,
42: new CodeSource(url, null), true);
43: }
44:
45:
48: public SharedLibLoader(String libname)
49: {
50: this(libname, getSystemClassLoader(), 0);
51: }
52:
53: public Class findClass(String name)
54: throws ClassNotFoundException
55: {
56: Class cls = helper.findClass(name);
57: if (cls == null)
58: throw new ClassNotFoundException(name);
59: return cls;
60: }
61:
62: public URL findResource (String name)
63: {
64: return helper.findResource(name);
65: }
66:
67: public Enumeration findResources (String name) throws IOException
68: {
69: URL url = findResource(name);
70: if (url == null)
71: return null;
72: Vector v = new Vector(1);
73: v.add(url);
74: return v.elements();
75: }
76:
77:
78: SharedLibHelper helper;
79: }